author
int64 658
755k
| date
stringlengths 19
19
| timezone
int64 -46,800
43.2k
| hash
stringlengths 40
40
| message
stringlengths 5
490
| mods
list | language
stringclasses 20
values | license
stringclasses 3
values | repo
stringlengths 5
68
| original_message
stringlengths 12
491
|
---|---|---|---|---|---|---|---|---|---|
426,496 | 25.04.2022 12:58:40 | -7,200 | 44c8be3e91653fed07bedec3e4bc9c09ab47a1ca | Show kubernetes events when waiting for a MPS instance to start
If the cluster has insufficient memory there was nothing shown excepts
"Starting MPS ...". Now the events contain more details why it doesn't
start. | [
{
"change_type": "MODIFY",
"old_path": "instances-manager/src/main/kotlin/org/modelix/instancesmanager/DeploymentManager.kt",
"new_path": "instances-manager/src/main/kotlin/org/modelix/instancesmanager/DeploymentManager.kt",
"diff": "@@ -216,6 +216,13 @@ class DeploymentManager {\nreturn null\n}\n+ fun getEvents(deploymentName: String?): List<V1Event> {\n+ if (deploymentName == null) return emptyList()\n+ val events: V1EventList = CoreV1Api().listNamespacedEvent(KUBERNETES_NAMESPACE, null, null, null, null, null, null, null, 10, null)\n+ return events.items\n+ .filter { (it.involvedObject.name ?: \"\").contains(deploymentName) }\n+ }\n+\n@Throws(IOException::class, ApiException::class)\nfun createDeployment(originalDeploymentName: String?, personalDeploymentName: String?): Boolean {\nvar originalDeploymentName = originalDeploymentName\n"
},
{
"change_type": "MODIFY",
"old_path": "instances-manager/src/main/kotlin/org/modelix/instancesmanager/DeploymentManagingHandler.kt",
"new_path": "instances-manager/src/main/kotlin/org/modelix/instancesmanager/DeploymentManagingHandler.kt",
"diff": "@@ -35,6 +35,7 @@ class DeploymentManagingHandler : AbstractHandler() {\nresponse.contentType = \"text/html\"\nresponse.status = HttpServletResponse.SC_OK\nval podLogs = deploymentManager.getPodLogs(redirectedURL.personalDeploymentName)\n+ val events = deploymentManager.getEvents(redirectedURL.personalDeploymentName)\nresponse.writer\n.append(\"<html>\")\n.append(\"<head>\")\n@@ -42,6 +43,26 @@ class DeploymentManagingHandler : AbstractHandler() {\n.append(\"</head>\")\n.append(\"<body>\")\n.append(\"<div>Starting MPS ...</div>\")\n+ if (events.isNotEmpty()) {\n+ response.writer.append(\"<br/><hr/><br/><table>\")\n+ for (event in events) {\n+ response.writer.append(\"<tr>\")\n+ response.writer.append(\"<td>\")\n+ StringEscapeUtils.escapeHtml(response.writer, event.type)\n+ response.writer.append(\"</td>\")\n+ response.writer.append(\"<td>\")\n+ StringEscapeUtils.escapeHtml(response.writer, event.reason)\n+ response.writer.append(\"</td>\")\n+ response.writer.append(\"<td>\")\n+ StringEscapeUtils.escapeHtml(response.writer, event.eventTime?.toString() ?: \"\")\n+ response.writer.append(\"</td>\")\n+ response.writer.append(\"<td>\")\n+ StringEscapeUtils.escapeHtml(response.writer, event.message)\n+ response.writer.append(\"</td>\")\n+ response.writer.append(\"</tr>\")\n+ }\n+ response.writer.append(\"</table>\")\n+ }\nif (podLogs != null) {\nresponse.writer.append(\"<br/><hr/><br/><pre>\")\nStringEscapeUtils.escapeHtml(response.writer, podLogs)\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Show kubernetes events when waiting for a MPS instance to start
If the cluster has insufficient memory there was nothing shown excepts
"Starting MPS ...". Now the events contain more details why it doesn't
start. |
426,496 | 25.04.2022 14:10:23 | -7,200 | ec5f6eca9010f2849e1a992876d5f06c597526f0 | interface for managing MPS instances | [
{
"change_type": "MODIFY",
"old_path": "instances-manager/build.gradle",
"new_path": "instances-manager/build.gradle",
"diff": "@@ -46,6 +46,13 @@ dependencies {\nimplementation(project(path: \":model-client\", configuration: \"jvmRuntimeElements\"))\nimplementation(project(path: \":workspaces\"))\n+\n+ def ktorVersion = \"1.6.5\"\n+ def kotlinCoroutinesVersion = \"1.5.2\"\n+ implementation(group: \"io.ktor\", name: \"ktor-server-core\", version: ktorVersion)\n+ implementation(group: \"io.ktor\", name: \"ktor-server-netty\", version: ktorVersion)\n+ implementation(group: \"org.jetbrains.kotlinx\", name: \"kotlinx-coroutines-jdk8\", version: kotlinCoroutinesVersion)\n+ implementation(group: \"io.ktor\", name: \"ktor-html-builder\", version: ktorVersion)\n}\nassemble.dependsOn shadowJar\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "instances-manager/src/main/kotlin/org/modelix/instancesmanager/AdminModule.kt",
"diff": "+/*\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.modelix.instancesmanager\n+\n+import io.ktor.application.*\n+import io.ktor.features.*\n+import io.ktor.http.*\n+import io.ktor.response.*\n+import io.ktor.routing.*\n+\n+fun Application.adminModule() {\n+ install(Routing)\n+ install(CORS) {\n+ anyHost()\n+ header(HttpHeaders.ContentType)\n+ method(HttpMethod.Options)\n+ method(HttpMethod.Get)\n+ method(HttpMethod.Put)\n+ method(HttpMethod.Post)\n+ }\n+\n+ routing {\n+ get(\"/\") {\n+ call.respondText(\"Admin\", ContentType.Text.Plain, HttpStatusCode.Found)\n+ }\n+ }\n+}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "instances-manager/src/main/kotlin/org/modelix/instancesmanager/Main.kt",
"new_path": "instances-manager/src/main/kotlin/org/modelix/instancesmanager/Main.kt",
"diff": "@@ -15,6 +15,7 @@ package org.modelix.instancesmanager\nimport io.kubernetes.client.openapi.ApiException\nimport org.apache.log4j.Logger\n+import org.eclipse.jetty.proxy.ProxyServlet\nimport org.eclipse.jetty.server.Request\nimport org.eclipse.jetty.server.Server\nimport org.eclipse.jetty.server.handler.DefaultHandler\n@@ -36,6 +37,7 @@ object Main {\n@JvmStatic\nfun main(args: Array<String>) {\ntry {\n+ io.ktor.server.netty.EngineMain.main(args)\nstartServer()\n} catch (ex: ApiException) {\nLOG.error(\"\", ex)\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "instances-manager/src/main/resources/application.conf",
"diff": "+ktor {\n+ deployment {\n+ port = 28106\n+ }\n+ application {\n+ modules = [\n+ org.modelix.instancesmanager.AdminModuleKt.adminModule\n+ ]\n+ }\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "kubernetes/common/instances-manager-service.yaml",
"new_path": "kubernetes/common/instances-manager-service.yaml",
"diff": "@@ -13,5 +13,8 @@ spec:\n- name: \"jvm-debug\"\nport: 5005\ntargetPort: 5005\n+ - name: \"admin\"\n+ port: 28106\n+ targetPort: 28106\nselector:\napp: instances-manager\n"
},
{
"change_type": "MODIFY",
"old_path": "proxy/nginx.conf",
"new_path": "proxy/nginx.conf",
"diff": "@@ -57,6 +57,13 @@ http {\nproxy_pass http://workspace-manager.default.svc.cluster.local:28104/$1$is_args$args;\n}\n+ location ~ ^/instances-manager/(.*)$ {\n+ proxy_http_version 1.1;\n+ proxy_set_header Upgrade $http_upgrade;\n+ proxy_set_header Connection \"upgrade\";\n+ proxy_pass http://instances-manager.default.svc.cluster.local:28106/$1$is_args$args;\n+ }\n+\nlocation ~ ^/([a-zA-Z0-9-_*]+/.*)$ {\nproxy_http_version 1.1;\nproxy_set_header Upgrade $http_upgrade;\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "update-proxy.sh",
"diff": "+#!/bin/sh\n+\n+set -e\n+\n+rm -f modelix.version\n+\n+./docker-build-proxy.sh\n+kubectl apply -f kubernetes/common/proxy-deployment.yaml -f kubernetes/common/proxy-service.yaml\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | interface for managing MPS instances |
426,496 | 25.04.2022 16:22:24 | -7,200 | aaa8abc239468b7d8dfd58a0b93d014026a28de5 | The user can now stop instances if the cluster runs out of memory | [
{
"change_type": "MODIFY",
"old_path": "instances-manager/src/main/kotlin/org/modelix/instancesmanager/AdminModule.kt",
"new_path": "instances-manager/src/main/kotlin/org/modelix/instancesmanager/AdminModule.kt",
"diff": "@@ -15,9 +15,12 @@ package org.modelix.instancesmanager\nimport io.ktor.application.*\nimport io.ktor.features.*\n+import io.ktor.html.*\nimport io.ktor.http.*\n+import io.ktor.request.*\nimport io.ktor.response.*\nimport io.ktor.routing.*\n+import kotlinx.html.*\nfun Application.adminModule() {\ninstall(Routing)\n@@ -32,7 +35,75 @@ fun Application.adminModule() {\nrouting {\nget(\"/\") {\n- call.respondText(\"Admin\", ContentType.Text.Plain, HttpStatusCode.Found)\n+ call.respondHtml(HttpStatusCode.OK) {\n+ head {\n+ title = \"Manage MPS Instances\"\n+ style {\n+ +\"\"\"\n+ table {\n+ border-collapse: collapse;\n+ }\n+ td, th {\n+ border: 1px solid #888;\n+ padding: 3px 12px;\n+ }\n+ \"\"\".trimIndent()\n+ }\n+ }\n+ body {\n+ table {\n+ thead {\n+ tr {\n+ th { +\"Path\" }\n+ th { +\"User\" }\n+ th { +\"Instance ID\" }\n+ }\n+ }\n+ for (deployment in DeploymentManager.INSTANCE.listDeployments()) {\n+ tr {\n+ td { +deployment.path }\n+ td { +(deployment.user ?: \"\") }\n+ td { +deployment.id }\n+ td {\n+ if (deployment.disabled) {\n+ postForm(\"enable-instance\") {\n+ hiddenInput {\n+ name = \"instanceId\"\n+ value = deployment.id\n+ }\n+ submitInput {\n+ value = \"Enable\"\n+ }\n+ }\n+ } else {\n+ postForm(\"disable-instance\") {\n+ hiddenInput {\n+ name = \"instanceId\"\n+ value = deployment.id\n+ }\n+ submitInput {\n+ value = \"Disable\"\n+ }\n+ }\n+ }\n+ }\n+ }\n+ }\n+ }\n+ }\n+ }\n+ }\n+\n+ post(\"disable-instance\") {\n+ val instanceId = call.receiveParameters()[\"instanceId\"]!!\n+ DeploymentManager.INSTANCE.disableInstance(instanceId)\n+ call.respondRedirect(\".\")\n+ }\n+\n+ post(\"enable-instance\") {\n+ val instanceId = call.receiveParameters()[\"instanceId\"]!!\n+ DeploymentManager.INSTANCE.enableInstance(instanceId)\n+ call.respondRedirect(\".\")\n}\n}\n}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "instances-manager/src/main/kotlin/org/modelix/instancesmanager/DeploymentManager.kt",
"new_path": "instances-manager/src/main/kotlin/org/modelix/instancesmanager/DeploymentManager.kt",
"diff": "@@ -23,9 +23,6 @@ import io.kubernetes.client.util.ClientBuilder\nimport io.kubernetes.client.util.Yaml\nimport org.apache.log4j.Logger\nimport org.eclipse.jetty.server.Request\n-import org.json.JSONObject\n-import org.modelix.instancesmanager.DeploymentManager\n-import org.modelix.model.client.RestWebModelClient\nimport org.modelix.workspaces.WorkspaceHash\nimport org.modelix.workspaces.WorkspacePersistence\nimport java.io.IOException\n@@ -56,13 +53,36 @@ class DeploymentManager {\n}\nprivate val managerId = java.lang.Long.toHexString(System.currentTimeMillis() / 1000)\nprivate val deploymentSuffixSequence = AtomicLong(0xf)\n- private val assignments = Collections.synchronizedMap(HashMap<String?, Assignments>())\n+ private val assignments = Collections.synchronizedMap(HashMap<String, Assignments>())\n+ private val disabledInstances = HashSet<String>()\nprivate val dirty = AtomicBoolean(true)\nprivate val workspacePersistence = WorkspacePersistence()\n- private fun getAssignments(originalDeploymentName: String?): Assignments {\n- return assignments.computeIfAbsent(originalDeploymentName) { originalDeploymentName: String? -> Assignments(originalDeploymentName) }\n+ private fun getAssignments(originalDeploymentName: String): Assignments {\n+ return assignments.computeIfAbsent(originalDeploymentName) { originalDeploymentName: String -> Assignments(originalDeploymentName) }\n}\n+ fun listDeployments(): List<InstanceStatus> {\n+ return assignments.entries.flatMap { assignment ->\n+ assignment.value.listDeployments().map { deployment ->\n+ InstanceStatus(assignment.key, deployment.first, deployment.second, disabledInstances.contains(deployment.second))\n+ }\n+ }\n+ }\n+\n+ fun disableInstance(instanceId: String) {\n+ disabledInstances += instanceId\n+ dirty.set(true)\n+ reconcileDeployments()\n+ }\n+\n+ fun enableInstance(instanceId: String) {\n+ disabledInstances -= instanceId\n+ dirty.set(true)\n+ reconcileDeployments()\n+ }\n+\n+ fun isInstanceDisabled(instanceId: String): Boolean = disabledInstances.contains(instanceId)\n+\nprivate fun generatePersonalDeploymentName(originalDeploymentName: String?): String {\nval cleanName = originalDeploymentName!!.lowercase(Locale.getDefault()).replace(\"[^a-z0-9-]\".toRegex(), \"\")\nvar deploymentName = PERSONAL_DEPLOYMENT_PREFIX + managerId + \"-\" + cleanName\n@@ -81,7 +101,10 @@ class DeploymentManager {\nval metadata = deployment.metadata ?: continue\nval annotations = metadata.annotations ?: continue\nif (\"true\" == annotations[INSTANCE_PER_USER_ANNOTATION_KEY]) {\n- getAssignments(metadata.name).setNumberOfUnassigned(deployment)\n+ val name = metadata.name\n+ if (name != null) {\n+ getAssignments(name).setNumberOfUnassigned(deployment)\n+ }\n}\n}\n} catch (e: ApiException) {\n@@ -140,10 +163,12 @@ class DeploymentManager {\nfor (assignment in assignments.values) {\nassignment.removeTimedOut()\nfor (deployment in assignment.getAllDeploymentNames()) {\n+ if (!disabledInstances.contains(deployment)) {\nexpectedDeployments[deployment] = assignment.originalDeploymentName\n}\n}\n}\n+ }\nval appsApi = AppsV1Api()\nval coreApi = CoreV1Api()\nval deployments = appsApi.listNamespacedDeployment(KUBERNETES_NAMESPACE, null, null, null, null, null, null, null, null, null)\n@@ -316,11 +341,16 @@ class DeploymentManager {\n}\n}\n- private inner class Assignments(val originalDeploymentName: String?) {\n- private val userId2deployment: MutableMap<String?, String?> = HashMap()\n- private val unassignedDeployments: MutableList<String?> = LinkedList()\n+ private inner class Assignments(val originalDeploymentName: String) {\n+ private val userId2deployment: MutableMap<String, String> = HashMap()\n+ private val unassignedDeployments: MutableList<String> = LinkedList()\n+\n+ fun listDeployments(): List<Pair<String?, String>> {\n+ return userId2deployment.map { it.key to it.value } + unassignedDeployments.map { null to it }\n+ }\n+\n@Synchronized\n- fun getOrCreate(userId: String?): String? {\n+ fun getOrCreate(userId: String): String {\nvar personalDeployment = userId2deployment[userId]\nif (personalDeployment == null) {\nif (unassignedDeployments.isEmpty()) {\n@@ -329,7 +359,7 @@ class DeploymentManager {\npersonalDeployment = unassignedDeployments.removeAt(0)\nunassignedDeployments.add(generatePersonalDeploymentName(originalDeploymentName))\n}\n- userId2deployment[userId] = personalDeployment\n+ userId2deployment[userId] = personalDeployment!!\ndirty.set(true)\n}\nDeploymentTimeouts.Companion.INSTANCE.update(personalDeployment)\n"
},
{
"change_type": "MODIFY",
"old_path": "instances-manager/src/main/kotlin/org/modelix/instancesmanager/DeploymentManagingHandler.kt",
"new_path": "instances-manager/src/main/kotlin/org/modelix/instancesmanager/DeploymentManagingHandler.kt",
"diff": "@@ -25,24 +25,33 @@ class DeploymentManagingHandler : AbstractHandler() {\ntry {\nval deploymentManager: DeploymentManager = DeploymentManager.Companion.INSTANCE\nval redirectedURL = deploymentManager.redirect(baseRequest, request) ?: return\n- if (redirectedURL.personalDeploymentName == null) return\n- DeploymentTimeouts.Companion.INSTANCE.update(redirectedURL.personalDeploymentName)\n- val deployment = deploymentManager.getDeployment(redirectedURL.personalDeploymentName, 3)\n- ?: throw RuntimeException(\"Failed to create deployment \" + redirectedURL.personalDeploymentName + \" for user \" + redirectedURL.userId)\n+ val personalDeploymentName = redirectedURL.personalDeploymentName ?: return\n+\n+ if (DeploymentManager.INSTANCE.isInstanceDisabled(personalDeploymentName)) {\n+ baseRequest.isHandled = true\n+ response.contentType = \"text/html\"\n+ response.status = HttpServletResponse.SC_OK\n+ response.writer.append(\"\"\"<html><body>Instance is disabled. (<a href=\"/instances-manager/\" target=\"_blank\">Manage Instances</a>)</body></html>\"\"\")\n+ return\n+ }\n+\n+ DeploymentTimeouts.INSTANCE.update(personalDeploymentName)\n+ val deployment = deploymentManager.getDeployment(personalDeploymentName, 3)\n+ ?: throw RuntimeException(\"Failed to create deployment \" + personalDeploymentName + \" for user \" + redirectedURL.userId)\nval readyReplicas = if (deployment.status != null) deployment.status!!.readyReplicas else null\nif (readyReplicas == null || readyReplicas == 0) {\nbaseRequest.isHandled = true\nresponse.contentType = \"text/html\"\nresponse.status = HttpServletResponse.SC_OK\n- val podLogs = deploymentManager.getPodLogs(redirectedURL.personalDeploymentName)\n- val events = deploymentManager.getEvents(redirectedURL.personalDeploymentName)\n+ val podLogs = deploymentManager.getPodLogs(personalDeploymentName)\n+ val events = deploymentManager.getEvents(personalDeploymentName)\nresponse.writer\n.append(\"<html>\")\n.append(\"<head>\")\n.append(\"<meta http-equiv=\\\"refresh\\\" content=\\\"5\\\">\")\n.append(\"</head>\")\n.append(\"<body>\")\n- .append(\"<div>Starting MPS ...</div>\")\n+ .append(\"<div>Starting MPS ... (<a href=\\\"/instances-manager/\\\" target=\\\"_blank\\\">Manage Instances</a>)</div>\")\nif (events.isNotEmpty()) {\nresponse.writer.append(\"<br/><hr/><br/><table>\")\nfor (event in events) {\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "instances-manager/src/main/kotlin/org/modelix/instancesmanager/InstanceStatus.kt",
"diff": "+/*\n+ * Copyright 2003-2022 JetBrains s.r.o.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.modelix.instancesmanager\n+\n+class InstanceStatus(val path: String, val user: String?, val id: String, val disabled: Boolean) {\n+}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "instances-manager/src/main/kotlin/org/modelix/instancesmanager/Main.kt",
"new_path": "instances-manager/src/main/kotlin/org/modelix/instancesmanager/Main.kt",
"diff": "@@ -37,8 +37,8 @@ object Main {\n@JvmStatic\nfun main(args: Array<String>) {\ntry {\n- io.ktor.server.netty.EngineMain.main(args)\nstartServer()\n+ io.ktor.server.netty.EngineMain.main(args)\n} catch (ex: ApiException) {\nLOG.error(\"\", ex)\nLOG.error(\"code: \" + ex.code)\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | The user can now stop instances if the cluster runs out of memory |
426,496 | 26.04.2022 09:32:25 | -7,200 | 30d3606f8f3a38b0cd6e5359de2c899c86c15f55 | Grey out disabled instances | [
{
"change_type": "MODIFY",
"old_path": "instances-manager/src/main/kotlin/org/modelix/instancesmanager/AdminModule.kt",
"new_path": "instances-manager/src/main/kotlin/org/modelix/instancesmanager/AdminModule.kt",
"diff": "@@ -61,6 +61,9 @@ fun Application.adminModule() {\n}\nfor (deployment in DeploymentManager.INSTANCE.listDeployments()) {\ntr {\n+ if (deployment.disabled) {\n+ style = \"color: #aaa\"\n+ }\ntd { +deployment.path }\ntd { +(deployment.user ?: \"\") }\ntd { +deployment.id }\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Grey out disabled instances |
426,496 | 26.04.2022 10:18:25 | -7,200 | 35bd6ca245cf29ba25ff9118d4b503b133c648bb | Include time in kubernetes events | [
{
"change_type": "MODIFY",
"old_path": "instances-manager/src/main/kotlin/org/modelix/instancesmanager/DeploymentManagingHandler.kt",
"new_path": "instances-manager/src/main/kotlin/org/modelix/instancesmanager/DeploymentManagingHandler.kt",
"diff": "*/\npackage org.modelix.instancesmanager\n+import io.kubernetes.client.openapi.models.V1Event\nimport org.apache.commons.lang.StringEscapeUtils\nimport org.apache.log4j.Logger\nimport org.eclipse.jetty.server.Request\nimport org.eclipse.jetty.server.handler.AbstractHandler\n+import org.joda.time.DateTime\n+import org.joda.time.Duration\n+import org.joda.time.ReadableDuration\nimport javax.servlet.http.HttpServletRequest\nimport javax.servlet.http.HttpServletResponse\n@@ -45,25 +49,42 @@ class DeploymentManagingHandler : AbstractHandler() {\nresponse.status = HttpServletResponse.SC_OK\nval podLogs = deploymentManager.getPodLogs(personalDeploymentName)\nval events = deploymentManager.getEvents(personalDeploymentName)\n- response.writer\n- .append(\"<html>\")\n- .append(\"<head>\")\n- .append(\"<meta http-equiv=\\\"refresh\\\" content=\\\"5\\\">\")\n- .append(\"</head>\")\n- .append(\"<body>\")\n- .append(\"<div>Starting MPS ... (<a href=\\\"/instances-manager/\\\" target=\\\"_blank\\\">Manage Instances</a>)</div>\")\n+ val eventTime: (V1Event)-> DateTime? = {\n+ listOfNotNull(\n+ it.eventTime,\n+ it.lastTimestamp,\n+ it.firstTimestamp\n+ ).firstOrNull()\n+ }\n+ response.writer.append(\"\"\"\n+ <html>\n+ <head>\n+ <meta http-equiv=\"refresh\" content=\"5\">\n+ <style>\n+ table {\n+ border-collapse: collapse;\n+ }\n+ td {\n+ border: 1px solid #aaa;\n+ padding: 0px 6px;\n+ }\n+ </style>\n+ </head>\n+ <body>\n+ <div>Starting MPS ... (<a href=\"/instances-manager/\" target=\"_blank\">Manage Instances</a>)</div>\n+ \"\"\".trimIndent())\nif (events.isNotEmpty()) {\nresponse.writer.append(\"<br/><hr/><br/><table>\")\n- for (event in events) {\n+ for (event in events.sortedBy(eventTime)) {\nresponse.writer.append(\"<tr>\")\nresponse.writer.append(\"<td>\")\n- StringEscapeUtils.escapeHtml(response.writer, event.type)\n+ StringEscapeUtils.escapeHtml(response.writer, eventTime(event)?.toLocalTime()?.toString(\"HH:mm:ss\") ?: \"---\")\nresponse.writer.append(\"</td>\")\nresponse.writer.append(\"<td>\")\n- StringEscapeUtils.escapeHtml(response.writer, event.reason)\n+ StringEscapeUtils.escapeHtml(response.writer, event.type)\nresponse.writer.append(\"</td>\")\nresponse.writer.append(\"<td>\")\n- StringEscapeUtils.escapeHtml(response.writer, event.eventTime?.toString() ?: \"\")\n+ StringEscapeUtils.escapeHtml(response.writer, event.reason)\nresponse.writer.append(\"</td>\")\nresponse.writer.append(\"<td>\")\nStringEscapeUtils.escapeHtml(response.writer, event.message)\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Include time in kubernetes events |
426,504 | 27.04.2022 09:09:39 | -7,200 | 272381e01da9da55f115384aaba56ea46c5f0766 | in model server history consider the case where no repos are available | [
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/kotlin/org/modelix/model/server/HistoryHandler.kt",
"new_path": "model-server/src/main/kotlin/org/modelix/model/server/HistoryHandler.kt",
"diff": "@@ -96,8 +96,8 @@ class HistoryHandler(private val client: IModelClient) : AbstractHandler() {\nval knownRepositoryIds: Set<RepositoryAndBranch>\nget() {\nval result: MutableSet<RepositoryAndBranch> = HashSet()\n- val infoVersionHash = client[RepositoryId(\"info\").getBranchKey()]\n- val infoVersion = CLVersion(infoVersionHash!!, client.storeCache!!)\n+ val infoVersionHash = client[RepositoryId(\"info\").getBranchKey()] ?: return emptySet()\n+ val infoVersion = CLVersion(infoVersionHash, client.storeCache!!)\nval infoBranch: IBranch = MetaModelBranch(PBranch(infoVersion.tree, IdGeneratorDummy()))\ninfoBranch.runReadT { t: IReadTransaction ->\nfor (infoNodeId in t.getChildren(ITree.ROOT_ID, \"info\")) {\n@@ -115,6 +115,19 @@ class HistoryHandler(private val client: IModelClient) : AbstractHandler() {\n}\nfun buildMainPage(out: PrintWriter) {\n+ val content = if (knownRepositoryIds.isEmpty()) {\n+ \"<p><i>No repositories available, add one</i></p>\"\n+ } else {\n+ \"\"\"<ul>\n+ | ${knownRepositoryIds.map { repositoryAndBranch -> \"\"\"\n+ <li>\n+ <a href='${escapeURL(repositoryAndBranch.toString())}/'>${escape(repositoryAndBranch.toString())}</a>\n+ </li>\n+ \"\"\" }.joinToString(\"\\n\")}\n+ |</ul>\n+ \"\"\".trimMargin()\n+ }\n+\nout.append(\"\"\"\n<html>\n<head>\n@@ -123,17 +136,7 @@ class HistoryHandler(private val client: IModelClient) : AbstractHandler() {\n</head>\n<body>\n<h1>Choose Repository</h1>\n- <ul>\n- \"\"\")\n- for (repositoryAndBranch in knownRepositoryIds) {\n- out.append(\"\"\"\n- <li>\n- <a href='${escapeURL(repositoryAndBranch.toString())}/'>${escape(repositoryAndBranch.toString())}</a>\n- </li>\n- \"\"\")\n- }\n- out.append(\"\"\"\n- </ul>\n+ $content\n</body>\n</html>\n\"\"\")\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | in model server history consider the case where no repos are available |
426,504 | 28.04.2022 09:35:11 | -7,200 | 6e06ceb23e18cf130123db86a5ab6517583d20ea | update MPS Extensions | [
{
"change_type": "MODIFY",
"old_path": "model-client/build.gradle",
"new_path": "model-client/build.gradle",
"diff": "@@ -32,7 +32,7 @@ check.dependsOn ktlintCheck\nkotlin {\njvm()\n- js() {\n+ js(IR) {\n//browser {}\nnodejs {\ntestTask {\n@@ -46,7 +46,7 @@ kotlin {\ncommonMain {\ndependencies {\napi group: 'org.modelix', name: 'model-api', version: \"$mpsExtensionsVersion\"\n- implementation kotlin('stdlib-common')\n+ implementation kotlin('stdlib-common:1.4.31')\nimplementation(\"org.jetbrains.kotlinx:kotlinx-collections-immutable:0.3.4\")\n}\n}\n@@ -58,7 +58,7 @@ kotlin {\n}\njvmMain {\ndependencies {\n- implementation kotlin('stdlib-jdk8')\n+ implementation kotlin('stdlib-jdk8:1.4.31')\nimplementation group: 'io.vavr', name: 'vavr', version: '0.10.3'\nimplementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.11'\n"
},
{
"change_type": "MODIFY",
"old_path": "mps-version.properties",
"new_path": "mps-version.properties",
"diff": "mpsMajorVersion=2020.3\nmpsMinorVersion=5\nmpsVersion=2020.3.5\n-mpsExtensionsVersion=2020.3.2311.d08b348\n+mpsExtensionsVersion=2020.3.2328.fe19c0b\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | update MPS Extensions |
426,496 | 27.04.2022 13:50:47 | -7,200 | 24b95b55b1c19cac6d22d42c85813c437b875e41 | Model synchronisation was done in a wrong order
After a quick series of changes (typing a property) if happened that the
MPS model was synchronized with an outdated version causing some changes
to disappear. | [
{
"change_type": "MODIFY",
"old_path": "mps/org.modelix.model.mpsplugin/models/org.modelix.model.mpsplugin.mps",
"new_path": "mps/org.modelix.model.mpsplugin/models/org.modelix.model.mpsplugin.mps",
"diff": "</node>\n</node>\n<node concept=\"2tJIrI\" id=\"2wwX$bJ_1vC\" role=\"jymVt\" />\n+ <node concept=\"3clFb_\" id=\"4ugFf0zfd3P\" role=\"jymVt\">\n+ <property role=\"TrG5h\" value=\"isNewestTree\" />\n+ <node concept=\"37vLTG\" id=\"4ugFf0zfkqN\" role=\"3clF46\">\n+ <property role=\"TrG5h\" value=\"tree\" />\n+ <node concept=\"3uibUv\" id=\"4ugFf0zfn9M\" role=\"1tU5fm\">\n+ <ref role=\"3uigEE\" to=\"jks5:~ITree\" resolve=\"ITree\" />\n+ </node>\n+ </node>\n+ <node concept=\"10P_77\" id=\"4ugFf0zfnrv\" role=\"3clF45\" />\n+ <node concept=\"3Tmbuc\" id=\"4ugFf0zfqiQ\" role=\"1B3o_S\" />\n+ <node concept=\"3clFbS\" id=\"4ugFf0zfd3T\" role=\"3clF47\">\n+ <node concept=\"3clFbF\" id=\"4ugFf0zfsYI\" role=\"3cqZAp\">\n+ <node concept=\"3K4zz7\" id=\"4ugFf0zftZB\" role=\"3clFbG\">\n+ <node concept=\"2OqwBi\" id=\"4ugFf0zfuyO\" role=\"3K4E3e\">\n+ <node concept=\"37vLTw\" id=\"4ugFf0zfug6\" role=\"2Oq$k0\">\n+ <ref role=\"3cqZAo\" node=\"74bn2KwzJcC\" resolve=\"owner\" />\n+ </node>\n+ <node concept=\"liA8E\" id=\"4ugFf0zfuJI\" role=\"2OqNvi\">\n+ <ref role=\"37wK5l\" node=\"4ugFf0zfd3P\" resolve=\"isNewestTree\" />\n+ <node concept=\"37vLTw\" id=\"4ugFf0zfuZu\" role=\"37wK5m\">\n+ <ref role=\"3cqZAo\" node=\"4ugFf0zfkqN\" resolve=\"tree\" />\n+ </node>\n+ </node>\n+ </node>\n+ <node concept=\"3clFbT\" id=\"4ugFf0zfvfj\" role=\"3K4GZi\">\n+ <property role=\"3clFbU\" value=\"true\" />\n+ </node>\n+ <node concept=\"3y3z36\" id=\"4ugFf0zftz1\" role=\"3K4Cdx\">\n+ <node concept=\"10Nm6u\" id=\"4ugFf0zftJg\" role=\"3uHU7w\" />\n+ <node concept=\"37vLTw\" id=\"4ugFf0zftc5\" role=\"3uHU7B\">\n+ <ref role=\"3cqZAo\" node=\"74bn2KwzJcC\" resolve=\"owner\" />\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ <node concept=\"2tJIrI\" id=\"4ugFf0zf9A$\" role=\"jymVt\" />\n<node concept=\"3clFb_\" id=\"7ZZZU$lm9F1\" role=\"jymVt\">\n<property role=\"TrG5h\" value=\"syncToMPS\" />\n<property role=\"DiZV1\" value=\"true\" />\n<node concept=\"1bVj0M\" id=\"2dW7BM74hKX\" role=\"37wK5m\">\n<property role=\"3yWfEV\" value=\"true\" />\n<node concept=\"3clFbS\" id=\"2dW7BM74hKY\" role=\"1bW5cS\">\n+ <node concept=\"3clFbJ\" id=\"4ugFf0zhydL\" role=\"3cqZAp\">\n+ <node concept=\"3clFbS\" id=\"4ugFf0zhydN\" role=\"3clFbx\">\n+ <node concept=\"3cpWs6\" id=\"4ugFf0zi51P\" role=\"3cqZAp\">\n+ <node concept=\"10M0yZ\" id=\"4ugFf0zi5Hu\" role=\"3cqZAk\">\n+ <ref role=\"3cqZAo\" to=\"v18h:~Unit.INSTANCE\" resolve=\"INSTANCE\" />\n+ <ref role=\"1PxDUh\" to=\"v18h:~Unit\" resolve=\"Unit\" />\n+ </node>\n+ </node>\n+ </node>\n+ <node concept=\"3fqX7Q\" id=\"4ugFf0zi4Bs\" role=\"3clFbw\">\n+ <node concept=\"1rXfSq\" id=\"4ugFf0zi4Bu\" role=\"3fr31v\">\n+ <ref role=\"37wK5l\" node=\"4ugFf0zfd3P\" resolve=\"isNewestTree\" />\n+ <node concept=\"37vLTw\" id=\"4ugFf0zi4Bv\" role=\"37wK5m\">\n+ <ref role=\"3cqZAo\" node=\"7ZZZU$ln_4c\" resolve=\"tree\" />\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n<node concept=\"3clFbF\" id=\"4_k_9wJsGN6\" role=\"3cqZAp\">\n<node concept=\"1rXfSq\" id=\"4_k_9wJsGN7\" role=\"3clFbG\">\n<ref role=\"37wK5l\" node=\"4_k_9wJsw5F\" resolve=\"doSyncToMPS\" />\n</node>\n</node>\n<node concept=\"2tJIrI\" id=\"7ZZZU$lrSJa\" role=\"jymVt\" />\n+ <node concept=\"3clFb_\" id=\"4ugFf0zfvUD\" role=\"jymVt\">\n+ <property role=\"TrG5h\" value=\"isNewestTree\" />\n+ <node concept=\"37vLTG\" id=\"4ugFf0zfvUE\" role=\"3clF46\">\n+ <property role=\"TrG5h\" value=\"tree\" />\n+ <node concept=\"3uibUv\" id=\"4ugFf0zfvUF\" role=\"1tU5fm\">\n+ <ref role=\"3uigEE\" to=\"jks5:~ITree\" resolve=\"ITree\" />\n+ </node>\n+ </node>\n+ <node concept=\"10P_77\" id=\"4ugFf0zfvUG\" role=\"3clF45\" />\n+ <node concept=\"3Tmbuc\" id=\"4ugFf0zfvUH\" role=\"1B3o_S\" />\n+ <node concept=\"3clFbS\" id=\"4ugFf0zfvUT\" role=\"3clF47\">\n+ <node concept=\"3clFbF\" id=\"4ugFf0zf$SF\" role=\"3cqZAp\">\n+ <node concept=\"22lmx$\" id=\"4ugFf0zfABd\" role=\"3clFbG\">\n+ <node concept=\"17R0WA\" id=\"4ugFf0zfCjc\" role=\"3uHU7w\">\n+ <node concept=\"37vLTw\" id=\"4ugFf0zfCTh\" role=\"3uHU7w\">\n+ <ref role=\"3cqZAo\" node=\"4ugFf0zfvUE\" resolve=\"tree\" />\n+ </node>\n+ <node concept=\"37vLTw\" id=\"4ugFf0zfB_Q\" role=\"3uHU7B\">\n+ <ref role=\"3cqZAo\" node=\"1ohdiioAP2G\" resolve=\"newestTree\" />\n+ </node>\n+ </node>\n+ <node concept=\"3clFbC\" id=\"4ugFf0zf__D\" role=\"3uHU7B\">\n+ <node concept=\"37vLTw\" id=\"4ugFf0zf$SA\" role=\"3uHU7B\">\n+ <ref role=\"3cqZAo\" node=\"1ohdiioAP2G\" resolve=\"newestTree\" />\n+ </node>\n+ <node concept=\"10Nm6u\" id=\"4ugFf0zf_XN\" role=\"3uHU7w\" />\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ <node concept=\"2AHcQZ\" id=\"4ugFf0zfvUU\" role=\"2AJF6D\">\n+ <ref role=\"2AI5Lk\" to=\"wyt6:~Override\" resolve=\"Override\" />\n+ </node>\n+ </node>\n+ <node concept=\"2tJIrI\" id=\"4ugFf0zfz7V\" role=\"jymVt\" />\n<node concept=\"3clFb_\" id=\"7ZZZU$lmK$c\" role=\"jymVt\">\n<property role=\"TrG5h\" value=\"treeChanged\" />\n<node concept=\"37vLTG\" id=\"7ZZZU$lmKEb\" role=\"3clF46\">\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Model synchronisation was done in a wrong order
After a quick series of changes (typing a property) if happened that the
MPS model was synchronized with an outdated version causing some changes
to disappear. |
426,496 | 29.04.2022 15:28:26 | -7,200 | 1d15b3f5be35344c3da30eb76c8ba630b5c4d5d3 | Use long polling to receive model changes
For load balacing reasons the SSE connection was reconnected after half
a minute. Long polling is the better choice and the code got simpler.
The actual reason for this change was that the SSE based implementation
was unreliable. Often no changes were received from the server. | [
{
"change_type": "MODIFY",
"old_path": "model-client/src/jvmMain/kotlin/org/modelix/model/client/RestWebModelClient.kt",
"new_path": "model-client/src/jvmMain/kotlin/org/modelix/model/client/RestWebModelClient.kt",
"diff": "@@ -24,7 +24,6 @@ import org.modelix.model.IKeyListener\nimport org.modelix.model.IKeyValueStore\nimport org.modelix.model.KeyValueStoreCache\nimport org.modelix.model.api.IIdGenerator\n-import org.modelix.model.client.SharedExecutors.fixDelay\nimport org.modelix.model.lazy.IDeserializingKeyValueStore\nimport org.modelix.model.lazy.ObjectStoreCache\nimport org.modelix.model.lazy.PrefetchCache\n@@ -35,16 +34,8 @@ import java.io.File\nimport java.net.URLEncoder\nimport java.nio.charset.StandardCharsets\nimport java.util.LinkedList\n-import java.util.Objects\n-import java.util.concurrent.ExecutorService\n-import java.util.concurrent.Executors\n-import java.util.concurrent.ScheduledFuture\n-import java.util.concurrent.TimeUnit\n+import java.util.concurrent.*\nimport java.util.concurrent.atomic.AtomicInteger\n-import java.util.function.Consumer\n-import java.util.function.Predicate\n-import java.util.function.ToLongFunction\n-import java.util.stream.Stream\nimport javax.ws.rs.ProcessingException\nimport javax.ws.rs.client.Client\nimport javax.ws.rs.client.ClientBuilder\n@@ -53,7 +44,6 @@ import javax.ws.rs.client.Entity\nimport javax.ws.rs.core.HttpHeaders\nimport javax.ws.rs.core.MediaType\nimport javax.ws.rs.core.Response\n-import javax.ws.rs.sse.SseEventSource\nimport kotlin.collections.ArrayList\nimport kotlin.collections.HashMap\nimport kotlin.collections.LinkedHashMap\n@@ -143,10 +133,11 @@ class RestWebModelClient @JvmOverloads constructor(\nreturn field\n}\nprivate set\n- private val executorService: ExecutorService = Executors.newFixedThreadPool(10)\n+ private val requestExecutor: ExecutorService = Executors.newFixedThreadPool(10)\n+ private val pollingExecutor: ExecutorService = Executors.newCachedThreadPool()\nprivate val client: Client\n- private val sseClient: Client\n- private val listeners: MutableList<SseListener> = ArrayList()\n+ private val pollingClient: Client\n+ private val listeners: MutableList<PollingListener> = ArrayList()\noverride val asyncStore: IKeyValueStore = AsyncStore(this)\nprivate val cache = PrefetchCache.contextIndirectCache(ObjectStoreCache(KeyValueStoreCache(asyncStore)))\nprivate val pendingWrites = AtomicInteger(0)\n@@ -154,7 +145,6 @@ class RestWebModelClient @JvmOverloads constructor(\n@get:Synchronized\noverride lateinit var idGenerator: IIdGenerator\nprivate set\n- private val watchDogTask: ScheduledFuture<*>\nprivate var authToken = authToken_ ?: defaultToken\noverride fun toString() = \"RestWebModelClient($baseUrl)\"\n@@ -172,12 +162,12 @@ class RestWebModelClient @JvmOverloads constructor(\n}\nfun dispose() {\n- watchDogTask.cancel(false)\nsynchronized(listeners) {\n- listeners.forEach(Consumer { obj: SseListener -> obj.dispose() })\n+ listeners.forEach { it.dispose() }\nlisteners.clear()\n}\n- executorService.shutdown()\n+ requestExecutor.shutdown()\n+ pollingExecutor.shutdown()\n}\noverride fun getPendingSize(): Int = pendingWrites.get()\n@@ -283,12 +273,19 @@ class RestWebModelClient @JvmOverloads constructor(\n}\noverride fun listen(key: String, keyListener: IKeyListener) {\n- val sseListener = SseListener(key, keyListener)\n- synchronized(listeners) { listeners.add(sseListener) }\n+ val pollingListener = PollingListener(key, keyListener)\n+ synchronized(listeners) {\n+ listeners.add(pollingListener)\n+ pollingListener.start()\n+ }\n}\noverride fun removeListener(key: String, listener: IKeyListener) {\n- synchronized(listeners) { listeners.removeIf { Objects.equals(it.key, key) && it.keyListener === listener } }\n+ synchronized(listeners) {\n+ val toRemove = listeners.filter { it.key == key && it.keyListener === listener }\n+ listeners.removeAll(toRemove)\n+ toRemove.forEach { it.dispose() }\n+ }\n}\noverride fun put(key: String, value: String?) {\n@@ -407,92 +404,51 @@ class RestWebModelClient @JvmOverloads constructor(\noverride val storeCache: IDeserializingKeyValueStore\nget() = cache\n- inner class SseListener(val key: String, val keyListener: IKeyListener?) {\n- private val notificationLock = Any()\n+ inner class PollingListener(val key: String, val keyListener: IKeyListener) {\nprivate var lastValue: String? = null\n- private val sse = arrayOfNulls<Sse>(2)\n- private var disposed = false\n+ private var future: Future<*>? = null\nfun dispose() {\n- if (disposed) {\n- return\n- }\n- disposed = true\n- for (i in sse.indices) {\n- if (sse[i] != null) {\n- sse[i]!!.sse.close()\n- sse[i] = null\n+ future?.cancel(true)\n}\n+ fun start() {\n+ future = pollingExecutor.submit {\n+ while (future?.isCancelled != true) {\n+ try {\n+ run()\n+ } catch (e: InterruptedException) {\n+ return@submit\n+ } catch (e: Exception) {\n+ LOG.error(\"Polling for '$key' failed\", e)\n+ sleep(5000)\n}\n}\n-\n- @Synchronized\n- fun ensureConnected() {\n- if (disposed) {\n- return\n- }\n- for (i in sse.indices) {\n- if (sse[i] == null) {\n- continue\n- }\n- if (sse[i]!!.birth > System.currentTimeMillis()) {\n- sse[i]!!.birth = System.currentTimeMillis()\n- }\n- if (!(sse[i]!!.sse.isOpen)) {\n- sse[i] = null\n}\n}\n- for (i in sse.indices) {\n- // To support rebalancing after scaling the cluster a connection shouldn't be open for too long.\n- if (sse[i] != null && sse[i]!!.age > 20000) {\n- sse[i]!!.sse.close()\n- sse[i] = null\n+ private fun run() {\n+ var url = baseUrl + \"poll/\" + URLEncoder.encode(key, StandardCharsets.UTF_8)\n+ if (lastValue != null) {\n+ url += \"?lastKnownValue=\" + URLEncoder.encode(lastValue, StandardCharsets.UTF_8)\n}\n+\n+ val response = client.target(url).request().buildGet().invoke()\n+ val value = when (response.status) {\n+ Response.Status.OK.statusCode -> {\n+ receivedSuccessfulResponse()\n+ response.readEntity(String::class.java)\n}\n- val youngest = Stream.of(*sse).filter(Predicate<Sse?> { obj: Sse? -> Objects.nonNull(obj) }).mapToLong(ToLongFunction<Sse?> { it: Sse? -> it!!.birth }).reduce(0L) { a: Long, b: Long -> Math.max(a, b) }\n- if (System.currentTimeMillis() - youngest < 5000) {\n- return\n+ Response.Status.NOT_FOUND.statusCode -> null\n+ else -> {\n+ if (response.forbidden) {\n+ receivedForbiddenResponse()\n}\n- for (i in sse.indices) {\n- if (sse[i] != null) {\n- continue\n+ throw RuntimeException(\"Request for key '\" + key + \"' failed: \" + response.statusInfo)\n}\n- val url = baseUrl + \"subscribe/\" + URLEncoder.encode(key, StandardCharsets.UTF_8)\n- if (LOG.isTraceEnabled) {\n- LOG.trace(\"Connecting to $url\")\n}\n- val target = sseClient.target(url)\n- sse[i] = Sse(SseEventSource.target(target).reconnectingEvery(1, TimeUnit.SECONDS).build())\n- sse[i]!!.sse.register(\n- { event ->\n- val value = event.readData()\n- synchronized(notificationLock) {\n- if (!((value == lastValue))) {\n+\n+ if (value != lastValue) {\nlastValue = value\n- keyListener!!.changed(key, value)\n- }\n- }\n- },\n- { ex ->\n- if (LOG.isEnabledFor(Level.ERROR)) {\n- LOG.error(\"\", ex)\n- }\n+ keyListener.changed(key, value)\n}\n- )\n- if (disposed) {\n- return\n- }\n- sse[i]!!.sse.open()\n- if (LOG.isTraceEnabled) {\n- LOG.trace(\"Connected to $url\")\n- }\n- break\n- }\n- }\n-\n- inner class Sse(val sse: SseEventSource) {\n- var birth = System.currentTimeMillis()\n- val age: Long\n- get() = System.currentTimeMillis() - birth\n}\n}\n@@ -507,29 +463,13 @@ class RestWebModelClient @JvmOverloads constructor(\n// is useful to recognize when the server is down\nclient = ClientBuilder.newBuilder()\n.connectTimeout(1000, TimeUnit.MILLISECONDS)\n- .executorService(executorService)\n+ .executorService(requestExecutor)\n// .readTimeout(1000, TimeUnit.MILLISECONDS)\n.register(ClientRequestFilter { ctx -> ctx.headers.add(HttpHeaders.AUTHORIZATION, \"Bearer $authToken\") }).build()\n- sseClient = ClientBuilder.newBuilder()\n+ pollingClient = ClientBuilder.newBuilder()\n.connectTimeout(1000, TimeUnit.MILLISECONDS)\n- .executorService(executorService)\n+ .executorService(pollingExecutor)\n.register(ClientRequestFilter { ctx -> ctx.headers.add(HttpHeaders.AUTHORIZATION, \"Bearer $authToken\") }).build()\nidGenerator = IdGenerator(clientId)\n- watchDogTask = fixDelay(\n- 1000,\n- Runnable {\n- var ls: List<SseListener>\n- synchronized(listeners) { ls = ArrayList(listeners) }\n- for (l: SseListener in ls) {\n- try {\n- l.ensureConnected()\n- } catch (ex: Exception) {\n- if (LOG.isEnabledFor(Level.ERROR)) {\n- LOG.error(\"\", ex)\n- }\n- }\n- }\n- }\n- )\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "model-client/src/jvmMain/kotlin/org/modelix/model/client/SharedExecutors.kt",
"new_path": "model-client/src/jvmMain/kotlin/org/modelix/model/client/SharedExecutors.kt",
"diff": "@@ -18,6 +18,7 @@ package org.modelix.model.client\nimport org.apache.log4j.Level\nimport org.apache.log4j.LogManager\nimport java.util.concurrent.Executors\n+import java.util.concurrent.Future\nimport java.util.concurrent.ScheduledFuture\nimport java.util.concurrent.TimeUnit\n@@ -32,9 +33,13 @@ object SharedExecutors {\n}\n@JvmStatic\n- fun fixDelay(milliSeconds: Int, r: Runnable): ScheduledFuture<*> {\n- return SCHEDULED.scheduleWithFixedDelay(\n- {\n+ fun fixDelay(periodMs: Long, r: Runnable): ScheduledFuture<*> {\n+ return fixDelay(periodMs, periodMs * 3, r)\n+ }\n+\n+ @JvmStatic\n+ fun fixDelay(periodMs: Long, timeoutMs: Long, r: Runnable): ScheduledFuture<*> {\n+ val body = Runnable {\ntry {\nr.run()\n} catch (ex: Exception) {\n@@ -42,8 +47,16 @@ object SharedExecutors {\nLOG.error(\"\", ex)\n}\n}\n- },\n- milliSeconds.toLong(), milliSeconds.toLong(), TimeUnit.MILLISECONDS\n- )\n+ }\n+\n+ var workerTask: Future<*>? = null\n+ return SCHEDULED.scheduleAtFixedRate({\n+ if (workerTask == null || (workerTask?.isDone == true) || (workerTask?.isCancelled == true)) {\n+ workerTask = FIXED.submit(body)\n+ SCHEDULED.schedule({\n+ workerTask?.cancel(true)\n+ }, timeoutMs, TimeUnit.MILLISECONDS)\n+ }\n+ }, periodMs, periodMs, TimeUnit.MILLISECONDS)\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "model-server/run-model-server.sh",
"new_path": "model-server/run-model-server.sh",
"diff": "#!/bin/sh\n-java -XX:MaxRAMPercentage=75 -Djdbc.url=$jdbc_url -cp \"model-server/build/libs/*\" org.modelix.model.server.Main\n+java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5071 -XX:MaxRAMPercentage=75 -Djdbc.url=$jdbc_url -cp \"model-server/build/libs/*\" org.modelix.model.server.Main\n"
},
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/java/org/modelix/model/server/RestModelServer.java",
"new_path": "model-server/src/main/java/org/modelix/model/server/RestModelServer.java",
"diff": "@@ -149,6 +149,72 @@ public class RestModelServer {\n}),\n\"/get/*\");\n+ servletHandler.addServlet(new ServletHolder(new HttpServlet() {\n+ @Override\n+ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n+ if (!checkAuthorization(storeClient, req, resp)) return;\n+\n+ final String key = req.getPathInfo().substring(1);\n+ final String lastKnownValue = req.getParameter(\"lastKnownValue\");\n+\n+ if (key.startsWith(PROTECTED_PREFIX)) {\n+ resp.setStatus(HttpServletResponse.SC_FORBIDDEN);\n+ resp.setContentType(TEXT_PLAIN);\n+ resp.getWriter().print(\"Protected key.\");\n+ return;\n+ }\n+\n+ final String[] valueFromListener = new String[1];\n+\n+ Object lock = new Object();\n+ IKeyListener listener = (newKey, newValue) -> {\n+ synchronized (lock) {\n+ valueFromListener[0] = newValue;\n+ lock.notifyAll();\n+ }\n+ };\n+ try {\n+ storeClient.listen(key, listener);\n+\n+ if (lastKnownValue != null) {\n+ // This could be done before registering the listener, but then we have to check it twice,\n+ // because the value could change between the first read and registering the listener.\n+ // Most of the time the value will be equal to the last known value.\n+ // Registering the listener without needing it is less likely to happen.\n+ String value = storeClient.get(key);\n+ valueFromListener[0] = value;\n+ if (!Objects.equals(value, lastKnownValue)) {\n+ respondValue(resp, value);\n+ return;\n+ }\n+ }\n+\n+ try {\n+ synchronized (lock) {\n+ // Long polling. The request returns when the value changes.\n+ // Then the client will do a new request.\n+ lock.wait(25_000L);\n+ }\n+ } catch (InterruptedException e) {\n+ throw new RuntimeException(e);\n+ }\n+ } finally {\n+ storeClient.removeListener(key, listener);\n+ }\n+\n+ respondValue(resp, valueFromListener[0]);\n+ }\n+\n+ private void respondValue(HttpServletResponse resp, String value) throws IOException {\n+ if (value == null) {\n+ resp.setStatus(HttpServletResponse.SC_NOT_FOUND);\n+ } else {\n+ resp.setContentType(TEXT_PLAIN);\n+ resp.getWriter().print(value);\n+ }\n+ }\n+ }), \"/poll/*\");\n+\nservletHandler.addServlet(\nnew ServletHolder(\nnew HttpServlet() {\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "update-model-server.sh",
"diff": "+#!/bin/sh\n+\n+set -e\n+\n+rm -f modelix.version\n+\n+./gradlew :model-server:assemble\n+./docker-build-model.sh\n+kubectl apply -f kubernetes/common/model-deployment.yaml -f kubernetes/common/model-service.yaml\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Use long polling to receive model changes
For load balacing reasons the SSE connection was reconnected after half
a minute. Long polling is the better choice and the code got simpler.
The actual reason for this change was that the SSE based implementation
was unreliable. Often no changes were received from the server. |
426,496 | 03.05.2022 10:12:04 | -7,200 | ee51fc18cd75208dd5520fdad2ffbaebd73d2d37 | forward model serveer debug port | [
{
"change_type": "MODIFY",
"old_path": "kubernetes/common/model-service.yaml",
"new_path": "kubernetes/common/model-service.yaml",
"diff": "apiVersion: v1\nkind: Service\nmetadata:\n- annotations:\n- creationTimestamp: null\nlabels:\napp: model\nname: model\n@@ -12,7 +10,8 @@ spec:\n- name: \"28101\"\nport: 28101\ntargetPort: 28101\n+ - name: \"debug\"\n+ port: 5071\n+ targetPort: 5071\nselector:\napp: model\n-status:\n- loadBalancer: {}\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | forward model serveer debug port |
426,496 | 03.05.2022 10:17:25 | -7,200 | bc9559430554efc7a3eb4c96e216486cc5e853a0 | performance optimization during model synchronization
There was an expensive prefetch done at the beginning of each transaction.
Even if this didn't result in an actual query to the server, iterating
over the whole subtree of the meta model still caused a noticeable delay. | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "model-client/src/commonMain/kotlin/org/modelix/model/SubtreeChanges.kt",
"diff": "+/*\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.modelix.model\n+\n+import org.modelix.model.api.ITree\n+import org.modelix.model.api.ITreeChangeVisitor\n+import org.modelix.model.lazy.IBulkTree\n+import kotlin.jvm.Synchronized\n+\n+class SubtreeChanges(val cacheSize: Int) {\n+ private val newTreeOrder = ArrayDeque<ITree>(cacheSize)\n+ private val cache = HashMap<ITree, HashMap<ITree, Data>>()\n+\n+ @Synchronized\n+ fun getAffectedSubtrees(oldTree: ITree, newTree: ITree): Set<Long> {\n+ val old2data = cache.getOrPut(newTree) {\n+ newTreeOrder.addLast(newTree)\n+ HashMap()\n+ }\n+ val result = old2data.getOrPut(oldTree) { Data(oldTree, newTree) }.affectedSubtrees\n+ if (newTreeOrder.size > cacheSize) {\n+ cache.remove(newTreeOrder.removeFirst())\n+ }\n+ return result\n+ }\n+\n+ private inner class Data(val oldTree: ITree, val newTree: ITree) {\n+ val affectedSubtrees: Set<Long>\n+ init {\n+ require(oldTree is IBulkTree) { \"Type of tree is not supported: $oldTree\" }\n+ val affectedNodes = HashSet<Long>()\n+ newTree.visitChanges(oldTree, object : ITreeChangeVisitor {\n+\n+ override fun childrenChanged(nodeId: Long, role: String?) {\n+ affectedNodes += nodeId\n+ }\n+\n+ override fun containmentChanged(nodeId: Long) {\n+ // there is always a corresponding childrenChanged event for this\n+ }\n+\n+ override fun propertyChanged(nodeId: Long, role: String) {\n+ affectedNodes += nodeId\n+ }\n+\n+ override fun referenceChanged(nodeId: Long, role: String) {\n+ affectedNodes += nodeId\n+ }\n+ })\n+ affectedSubtrees = oldTree.getAncestors(affectedNodes, true)\n+ }\n+ }\n+\n+ companion object {\n+ val INSTANCE = SubtreeChanges(10)\n+ }\n+}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "model-client/src/commonMain/kotlin/org/modelix/model/lazy/CLNode.kt",
"new_path": "model-client/src/commonMain/kotlin/org/modelix/model/lazy/CLNode.kt",
"diff": "@@ -55,8 +55,11 @@ class CLNode(private val tree: CLTree, private val data: CPNode) {\nreturn tree\n}\n- val parent: CLNode\n- get() = tree.resolveElement(data.parentId) as CLNode\n+ val parent: CLNode?\n+ get() = tree.resolveElement(data.parentId)\n+\n+ val parentId: Long\n+ get() = data.parentId\nval roleInParent: String?\nget() = data.roleInParent\n@@ -87,6 +90,19 @@ class CLNode(private val tree: CLTree, private val data: CPNode) {\n}\n}\n+ fun getAncestors(bulkQuery: IBulkQuery, includeSelf: Boolean): IBulkQuery.Value<List<CLNode>> {\n+ return if (includeSelf) {\n+ getAncestors(bulkQuery, false).map { ancestors -> (listOf(this) + ancestors) }\n+ } else {\n+ val parentNode = parent\n+ if (parentNode == null) {\n+ bulkQuery.constant(listOf())\n+ } else {\n+ parentNode.getAncestors(bulkQuery, true)\n+ }\n+ }\n+ }\n+\nval concept: String?\nget() = getData().concept\n"
},
{
"change_type": "MODIFY",
"old_path": "model-client/src/commonMain/kotlin/org/modelix/model/lazy/CLTree.kt",
"new_path": "model-client/src/commonMain/kotlin/org/modelix/model/lazy/CLTree.kt",
"diff": "@@ -287,6 +287,15 @@ class CLTree : ITree, IBulkTree {\nreturn descendants.execute().flatten()\n}\n+ override fun getAncestors(nodeIds: Iterable<Long>, includeSelf: Boolean): Set<Long> {\n+ val bulkQuery = BulkQuery(store)\n+ val nodes: IBulkQuery.Value<List<CLNode>> = resolveElements(nodeIds, bulkQuery)\n+ val ancestors = nodes.mapBulk { bulkQuery.map(it) { it.getAncestors(bulkQuery, includeSelf) } }\n+ val result = HashSet<Long>()\n+ ancestors.execute().forEach { result.addAll(it.map { it.id }) }\n+ return result\n+ }\n+\noverride fun getChildren(parentId: Long, role: String?): Iterable<Long> {\nval parent = resolveElement(parentId)\nval children = parent!!.getChildren(BulkQuery(store)).execute()\n"
},
{
"change_type": "MODIFY",
"old_path": "model-client/src/commonMain/kotlin/org/modelix/model/lazy/IBulkTree.kt",
"new_path": "model-client/src/commonMain/kotlin/org/modelix/model/lazy/IBulkTree.kt",
"diff": "@@ -18,4 +18,5 @@ import org.modelix.model.api.ITree\ninterface IBulkTree : ITree {\nfun getDescendants(root: Long, includeSelf: Boolean): Iterable<CLNode>\nfun getDescendants(roots: Iterable<Long>, includeSelf: Boolean): Iterable<CLNode>\n+ fun getAncestors(nodeIds: Iterable<Long>, includeSelf: Boolean): Set<Long>\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "model-client/src/commonMain/kotlin/org/modelix/model/metameta/MetaModelBranch.kt",
"new_path": "model-client/src/commonMain/kotlin/org/modelix/model/metameta/MetaModelBranch.kt",
"diff": "@@ -65,9 +65,9 @@ class MetaModelBranch(val branch: IBranch) : IBranch by branch {\nprivate fun prefetch() {\n// prefetch only for the root transaction, not for all nested ones\n- if (!branch.canRead()) {\n- metaModelSynchronizer.prefetch()\n- }\n+// if (!branch.canRead()) {\n+// metaModelSynchronizer.prefetch()\n+// }\n}\noverride fun <T> computeRead(computable: () -> T): T {\n@@ -218,6 +218,10 @@ class MetaModelBranch(val branch: IBranch) : IBranch by branch {\noverride fun getWrappedTree(): ITree {\nreturn tree\n}\n+\n+ override fun getAncestors(nodeIds: Iterable<Long>, includeSelf: Boolean): Set<Long> {\n+ return tree.getAncestors(nodeIds, includeSelf)\n+ }\n}\ninner class MMBranchListener(val listener: IBranchListener) : IBranchListener {\n"
},
{
"change_type": "MODIFY",
"old_path": "model-client/src/commonMain/kotlin/org/modelix/model/metameta/MetaModelSynchronizer.kt",
"new_path": "model-client/src/commonMain/kotlin/org/modelix/model/metameta/MetaModelSynchronizer.kt",
"diff": "*/\npackage org.modelix.model.metameta\n+import org.modelix.model.SubtreeChanges\nimport org.modelix.model.api.*\nimport org.modelix.model.lazy.IBulkTree\n@@ -23,17 +24,28 @@ class MetaModelSynchronizer(val branch: IBranch) {\nval tree = branch.transaction.tree\nvar idx = cachedIndex\nif (idx == null) {\n+ prefetch()\nidx = MetaModelIndex.fromTree(tree)\n} else if (idx.tree == tree) {\nreturn idx\n} else {\n+ val oldLanguageNodes = idx.tree.getChildren(ITree.ROOT_ID, MetaModelIndex.LANGUAGES_ROLE).toSet()\n+ var anyChange = SubtreeChanges.INSTANCE.getAffectedSubtrees(idx.tree, tree).intersect(oldLanguageNodes).isNotEmpty()\n+ if (!anyChange) {\n+ val newLanguageNodes = tree.getChildren(ITree.ROOT_ID, MetaModelIndex.LANGUAGES_ROLE).toSet()\n+ anyChange = newLanguageNodes.size != oldLanguageNodes.size\n+ || oldLanguageNodes.intersect(newLanguageNodes).size != oldLanguageNodes.size\n+ }\n+ if (anyChange) {\n// Don't use ITree.visitChanges at all and just read the whole meta model\n// On large models this is faster, because the meta model part is very small compared\n// to the potentially large changes\n// idx = MetaModelIndex.incremental(idx, tree)\n+ prefetch()\nidx = MetaModelIndex.fromTree(tree)\n}\n+ }\ncachedIndex = idx\nreturn idx\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "model-client/src/commonMain/kotlin/org/modelix/model/operations/AddNewChildSubtreeOp.kt",
"new_path": "model-client/src/commonMain/kotlin/org/modelix/model/operations/AddNewChildSubtreeOp.kt",
"diff": "@@ -40,9 +40,9 @@ class AddNewChildSubtreeOp(val resultTreeHash: KVEntryReference<CPTree>, val pos\nval resultTree = getResultTree(store)\nfor (node in resultTree.getDescendants(childId, true)) {\nval pos = PositionInRole(\n- node.parent.id,\n+ node.parentId,\nnode.roleInParent,\n- resultTree.getChildren(node.parent.id, node.roleInParent).indexOf(node.id)\n+ resultTree.getChildren(node.parentId, node.roleInParent).indexOf(node.id)\n)\ndecompressNode(resultTree, node, pos, false, opsVisitor)\n}\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | performance optimization during model synchronization
There was an expensive prefetch done at the beginning of each transaction.
Even if this didn't result in an actual query to the server, iterating
over the whole subtree of the meta model still caused a noticeable delay. |
426,496 | 03.05.2022 11:08:17 | -7,200 | 495505d1141c87cecafcfc7f2b3128f32a7c293d | Missing synchronization in InMemoryStoreClient made the model-client tests fail | [
{
"change_type": "MODIFY",
"old_path": "model-client/build.gradle",
"new_path": "model-client/build.gradle",
"diff": "@@ -76,7 +76,6 @@ kotlin {\n}\njvmTest {\ndependencies {\n- implementation kotlin('test')\nimplementation kotlin('test-junit')\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/java/org/modelix/model/server/InMemoryStoreClient.java",
"new_path": "model-server/src/main/java/org/modelix/model/server/InMemoryStoreClient.java",
"diff": "@@ -31,7 +31,7 @@ import java.util.stream.Collectors;\npublic class InMemoryStoreClient implements IStoreClient {\nprivate final Map<String, String> values = new HashMap<>();\n- private final Map<String, List<IKeyListener>> listeners = new HashMap<>();\n+ private final Map<String, List<IKeyListener>> listeners = Collections.synchronizedMap(new HashMap<>());\n@Override\npublic String get(String key) {\n@@ -63,19 +63,23 @@ public class InMemoryStoreClient implements IStoreClient {\n@Override\npublic void listen(String key, IKeyListener listener) {\n+ synchronized (listeners) {\nif (!listeners.containsKey(key)) {\nlisteners.put(key, new LinkedList<>());\n}\nlisteners.get(key).add(listener);\n}\n+ }\n@Override\npublic void removeListener(String key, IKeyListener listener) {\n+ synchronized (listeners) {\nif (!listeners.containsKey(key)) {\nreturn;\n}\nlisteners.get(key).remove(listener);\n}\n+ }\n@Override\npublic long generateId(String key) {\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Missing synchronization in InMemoryStoreClient made the model-client tests fail |
426,496 | 03.05.2022 11:35:43 | -7,200 | 295324dc784822f926b5bfeb7f965a44efe95475 | model-server: format | [
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/java/org/modelix/model/server/InMemoryStoreClient.java",
"new_path": "model-server/src/main/java/org/modelix/model/server/InMemoryStoreClient.java",
"diff": "@@ -31,7 +31,8 @@ import java.util.stream.Collectors;\npublic class InMemoryStoreClient implements IStoreClient {\nprivate final Map<String, String> values = new HashMap<>();\n- private final Map<String, List<IKeyListener>> listeners = Collections.synchronizedMap(new HashMap<>());\n+ private final Map<String, List<IKeyListener>> listeners =\n+ Collections.synchronizedMap(new HashMap<>());\n@Override\npublic String get(String key) {\n"
},
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/java/org/modelix/model/server/RestModelServer.java",
"new_path": "model-server/src/main/java/org/modelix/model/server/RestModelServer.java",
"diff": "@@ -149,9 +149,12 @@ public class RestModelServer {\n}),\n\"/get/*\");\n- servletHandler.addServlet(new ServletHolder(new HttpServlet() {\n+ servletHandler.addServlet(\n+ new ServletHolder(\n+ new HttpServlet() {\n@Override\n- protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n+ protected void doGet(HttpServletRequest req, HttpServletResponse resp)\n+ throws ServletException, IOException {\nif (!checkAuthorization(storeClient, req, resp)) return;\nfinal String key = req.getPathInfo().substring(1);\n@@ -167,7 +170,8 @@ public class RestModelServer {\nfinal String[] valueFromListener = new String[1];\nObject lock = new Object();\n- IKeyListener listener = (newKey, newValue) -> {\n+ IKeyListener listener =\n+ (newKey, newValue) -> {\nsynchronized (lock) {\nvalueFromListener[0] = newValue;\nlock.notifyAll();\n@@ -177,10 +181,14 @@ public class RestModelServer {\nstoreClient.listen(key, listener);\nif (lastKnownValue != null) {\n- // This could be done before registering the listener, but then we have to check it twice,\n- // because the value could change between the first read and registering the listener.\n- // Most of the time the value will be equal to the last known value.\n- // Registering the listener without needing it is less likely to happen.\n+ // This could be done before registering the listener, but\n+ // then we have to check it twice,\n+ // because the value could change between the first read and\n+ // registering the listener.\n+ // Most of the time the value will be equal to the last\n+ // known value.\n+ // Registering the listener without needing it is less\n+ // likely to happen.\nString value = storeClient.get(key);\nvalueFromListener[0] = value;\nif (!Objects.equals(value, lastKnownValue)) {\n@@ -191,7 +199,8 @@ public class RestModelServer {\ntry {\nsynchronized (lock) {\n- // Long polling. The request returns when the value changes.\n+ // Long polling. The request returns when the value\n+ // changes.\n// Then the client will do a new request.\nlock.wait(25_000L);\n}\n@@ -205,7 +214,8 @@ public class RestModelServer {\nrespondValue(resp, valueFromListener[0]);\n}\n- private void respondValue(HttpServletResponse resp, String value) throws IOException {\n+ private void respondValue(HttpServletResponse resp, String value)\n+ throws IOException {\nif (value == null) {\nresp.setStatus(HttpServletResponse.SC_NOT_FOUND);\n} else {\n@@ -213,7 +223,8 @@ public class RestModelServer {\nresp.getWriter().print(value);\n}\n}\n- }), \"/poll/*\");\n+ }),\n+ \"/poll/*\");\nservletHandler.addServlet(\nnew ServletHolder(\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | model-server: format |
426,496 | 03.05.2022 14:14:55 | -7,200 | 48a638de1c6b207133a0b7389683d89fce5b0d20 | attempt to fix the model-client tests on github actions (2) | [
{
"change_type": "MODIFY",
"old_path": "model-client/src/jvmTest/kotlin/org/modelix/model/ModelClient_Test.kt",
"new_path": "model-client/src/jvmTest/kotlin/org/modelix/model/ModelClient_Test.kt",
"diff": "@@ -86,7 +86,13 @@ class ModelClient_Test {\nprintln(\" put $key = $value\")\nval client = rand.nextInt(clients.size)\nprintln(\" client is $client\")\n+ try {\nclients[client].put(key, value)\n+ } catch (e: Exception) {\n+ System.err.println(e.message)\n+ e.printStackTrace(System.err)\n+ throw e\n+ }\nprintln(\" put to client $client\")\nfor (client in clients) {\nAssert.assertEquals(expected[key], client[key])\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | attempt to fix the model-client tests on github actions (2)
(cherry picked from commit 1847349e06583bd796777eb91cbab128ed460f4f) |
426,496 | 03.05.2022 14:54:38 | -7,200 | 6f2c9916873dfa7c905e3fab6594db7678372cf0 | attempt to fix the model-client tests on github actions (3) | [
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/java/org/modelix/model/server/InMemoryStoreClient.java",
"new_path": "model-server/src/main/java/org/modelix/model/server/InMemoryStoreClient.java",
"diff": "@@ -31,63 +31,58 @@ import java.util.stream.Collectors;\npublic class InMemoryStoreClient implements IStoreClient {\nprivate final Map<String, String> values = new HashMap<>();\n- private final Map<String, List<IKeyListener>> listeners =\n- Collections.synchronizedMap(new HashMap<>());\n+ private final Map<String, List<IKeyListener>> listeners = new HashMap<>();\n@Override\n- public String get(String key) {\n+ public synchronized String get(String key) {\nreturn values.get(key);\n}\n@Override\n- public List<String> getAll(List<String> keys) {\n+ public synchronized List<String> getAll(List<String> keys) {\nreturn keys.stream().map(this::get).collect(Collectors.toList());\n}\n@Override\n- public Map<String, String> getAll(Set<String> keys) {\n+ public synchronized Map<String, String> getAll(Set<String> keys) {\nreturn keys.stream().collect(Collectors.toMap(Function.identity(), this::get));\n}\n@Override\n- public void put(String key, String value) {\n+ public synchronized void put(String key, String value) {\nvalues.put(key, value);\nlisteners.getOrDefault(key, Collections.emptyList()).forEach(l -> l.changed(key, value));\n}\n@Override\n- public void putAll(Map<String, String> entries) {\n+ public synchronized void putAll(Map<String, String> entries) {\nfor (Map.Entry<String, String> entry : entries.entrySet()) {\nput(entry.getKey(), entry.getValue());\n}\n}\n@Override\n- public void listen(String key, IKeyListener listener) {\n- synchronized (listeners) {\n+ public synchronized void listen(String key, IKeyListener listener) {\nif (!listeners.containsKey(key)) {\nlisteners.put(key, new LinkedList<>());\n}\nlisteners.get(key).add(listener);\n}\n- }\n@Override\n- public void removeListener(String key, IKeyListener listener) {\n- synchronized (listeners) {\n+ public synchronized void removeListener(String key, IKeyListener listener) {\nif (!listeners.containsKey(key)) {\nreturn;\n}\nlisteners.get(key).remove(listener);\n}\n- }\n@Override\npublic long generateId(String key) {\nreturn key.hashCode();\n}\n- public void dump(FileWriter fileWriter) throws IOException {\n+ public synchronized void dump(FileWriter fileWriter) throws IOException {\nfor (String key : values.keySet()) {\nfileWriter.append(key);\nfileWriter.append(\"#\");\n@@ -96,7 +91,7 @@ public class InMemoryStoreClient implements IStoreClient {\n}\n}\n- public int load(FileReader fileReader) {\n+ public synchronized int load(FileReader fileReader) {\nBufferedReader br = new BufferedReader(fileReader);\nint[] n = new int[] {0};\nbr.lines()\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | attempt to fix the model-client tests on github actions (3)
(cherry picked from commit ba9f323a6194bb0778bdce52375f6db771b15e1a) |
426,496 | 05.05.2022 17:39:13 | -7,200 | a585ab636b6822f7d0b2cdb9c5706400f6a465d8 | projector was still trying to download pako.js from the CDN
The docker build script wasn't using the local patched projector-client,
but downloading the official version instead. | [
{
"change_type": "MODIFY",
"old_path": "docker-build-projector-mps.sh",
"new_path": "docker-build-projector-mps.sh",
"diff": "@@ -29,12 +29,23 @@ TIMESTAMP=\"$(date +\"%Y%m%d%H%M\")\"\nelse\ngit clone https://github.com/JetBrains/projector-server.git\nfi\n+ (\n+ cd projector-server\n+ echo \"useLocalProjectorClient=true\" > local.properties\n+ )\n+\nif [ -d ./projector-client ]; then\n(\ncd projector-client\ngit reset --hard\ngit clean -xdf\ngit pull\n+ )\n+ else\n+ git clone https://github.com/JetBrains/projector-client.git\n+ fi\n+ (\n+ cd projector-client\n# If the internet connection is restricted trying to downloading pako.min.js causes the browser to do nothing\n# until the connection times out. This appears like the link for opening a node in projector is broken.\n@@ -42,9 +53,7 @@ TIMESTAMP=\"$(date +\"%Y%m%d%H%M\")\"\nwget https://cdn.jsdelivr.net/pako/1.0.3/pako.min.js\nsed -i.bak -E \"s/https:\\/\\/cdn.jsdelivr.net\\/pako\\/1.0.3\\/pako.min.js/pako.min.js/\" index.html\n)\n- else\n- git clone https://github.com/JetBrains/projector-client.git\n- fi\n+\nif [ -d ./projector-docker ]; then\n(\ncd projector-docker\n@@ -57,7 +66,7 @@ TIMESTAMP=\"$(date +\"%Y%m%d%H%M\")\"\nfi\ncd projector-docker\n- ./build-container.sh \"projector-mps\" \"https://download.jetbrains.com/mps/${mpsMajorVersion}/MPS-${mpsVersion}.tar.gz\"\n+ ./build-container-dev.sh \"projector-mps\" \"https://download.jetbrains.com/mps/${mpsMajorVersion}/MPS-${mpsVersion}.tar.gz\"\n)\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | projector was still trying to download pako.js from the CDN
The docker build script wasn't using the local patched projector-client,
but downloading the official version instead. |
426,496 | 10.05.2022 17:04:36 | -7,200 | 9db26238544d29991dff2e41c9ac300ad22d4d4c | Allow specifying additional generation dependencies
If building a workspace fails because the build script generator
fails to find a dependency, this dependency can now be added inside the
workspace configuration. | [
{
"change_type": "MODIFY",
"old_path": "headless-mps/src/main/kotlin/org/modelix/headlessmps/JavaProcess.kt",
"new_path": "headless-mps/src/main/kotlin/org/modelix/headlessmps/JavaProcess.kt",
"diff": "@@ -27,8 +27,8 @@ class JavaProcess(val mainClass: KClass<*>): ProcessExecutor() {\nval javaHome = System.getProperty(\"java.home\")\nval separator = File.separator\nval javaBin = \"$javaHome${separator}bin${separator}java\"\n- outputHandler(\"Classpath:\")\n- classpath.forEach { outputHandler(\" $it\") }\n+ //outputHandler(\"Classpath:\")\n+ //classpath.forEach { outputHandler(\" $it\") }\nval className = mainClass.qualifiedName ?: throw RuntimeException(\"mainClass has no qualifiedName\")\nval command: MutableList<String> = ArrayList()\ncommand += javaBin\n"
},
{
"change_type": "MODIFY",
"old_path": "headless-mps/src/main/kotlin/org/modelix/headlessmps/ModelImportMain.kt",
"new_path": "headless-mps/src/main/kotlin/org/modelix/headlessmps/ModelImportMain.kt",
"diff": "@@ -25,8 +25,8 @@ object ModelImportMain {\nif (envFile == null) throw IllegalArgumentException(\"$ENVIRONMENT_ARG_KEY argument is missing\")\nval environmentSpec = Json.decodeFromString<EnvironmentSpec>(envFile.readText(StandardCharsets.UTF_8))\n- println(\"*** Loading environment *** \")\n- println(environmentSpec.debugString())\n+ //println(\"*** Loading environment *** \")\n+ //println(environmentSpec.debugString())\n//Thread.currentThread().contextClassLoader = URLClassLoader(environmentSpec.classPath.map { File(it).toURI().toURL() }.toTypedArray())\nval mpsEnvironment = EnvironmentLoader(environmentSpec).loadEnvironment()\n"
},
{
"change_type": "MODIFY",
"old_path": "workspace-manager/build.gradle.kts",
"new_path": "workspace-manager/build.gradle.kts",
"diff": "@@ -38,7 +38,7 @@ dependencies {\nimplementation(project(\":headless-mps\"))\nimplementation(project(\":workspaces\"))\nimplementation(project(\":gitui\"))\n- implementation(\"org.modelix.mpsbuild:build-tools:1.0.0\")\n+ implementation(\"org.modelix.mpsbuild:build-tools:1.0.3\")\nimplementation(\"io.ktor\",\"ktor-html-builder\", ktorVersion)\ntestImplementation(\"org.junit.jupiter:junit-jupiter-api:5.6.0\")\ntestRuntimeOnly(\"org.junit.jupiter:junit-jupiter-engine\")\n"
},
{
"change_type": "MODIFY",
"old_path": "workspace-manager/src/main/kotlin/org/modelix/workspace/manager/WorkspaceManager.kt",
"new_path": "workspace-manager/src/main/kotlin/org/modelix/workspace/manager/WorkspaceManager.kt",
"diff": "*/\npackage org.modelix.workspace.manager\n+import io.ktor.utils.io.*\nimport kotlinx.serialization.decodeFromString\nimport kotlinx.serialization.encodeToString\nimport kotlinx.serialization.json.Json\n@@ -165,7 +166,11 @@ class WorkspaceManager {\nadditionalFolders.filter { it.exists() }.forEach { modulesMiner.searchInFolder(ModuleOrigin(it.toPath(), it.toPath())) }\njob.runSafely(WorkspaceBuildStatus.FailedBuild) {\n- val buildScriptGenerator = BuildScriptGenerator(modulesMiner, ignoredModules = workspace.ignoredModules.map { ModuleId(it) }.toSet())\n+ val buildScriptGenerator = BuildScriptGenerator(\n+ modulesMiner,\n+ ignoredModules = workspace.ignoredModules.map { ModuleId(it) }.toSet(),\n+ additionalGenerationDependencies = workspace.additionalGenerationDependenciesAsMap()\n+ )\njob.runSafely {\nmodulesXml = xmlToString(buildModulesXml(buildScriptGenerator.modulesMiner.getModules()))\n}\n@@ -278,7 +283,12 @@ class WorkspaceManager {\nif (cloudResourcesFile.exists()) cloudResourcesFile.delete()\n}\n- val json = buildEnvironmentSpec(modulesMiner.getModules(), mpsClassPath, job.workspace.ignoredModules.map { ModuleId(it) }.toSet())\n+ val json = buildEnvironmentSpec(\n+ modules = modulesMiner.getModules(),\n+ classPath = mpsClassPath,\n+ ignoredModules = job.workspace.ignoredModules.map { ModuleId(it) }.toSet(),\n+ additionalGenerationDependencies = job.workspace.additionalGenerationDependenciesAsMap()\n+ )\nval envFile = File(\"mps-environment.json\")\nenvFile.writeBytes(json.toByteArray(StandardCharsets.UTF_8))\n@@ -296,7 +306,10 @@ class WorkspaceManager {\n}\n}\n- private fun buildEnvironmentSpec(modules: FoundModules, classPath: List<String>, ignoredModules: Set<ModuleId>): String {\n+ private fun buildEnvironmentSpec(modules: FoundModules,\n+ classPath: List<String>,\n+ ignoredModules: Set<ModuleId>,\n+ additionalGenerationDependencies: Map<ModuleId, Set<ModuleId>>): String {\nval mpsHome = modules.mpsHome ?: throw RuntimeException(\"mps.home not found\")\nval plugins: MutableMap<String, PluginModuleOwner> = LinkedHashMap()\nval libraries = ArrayList<LibrarySpec>()\n@@ -304,7 +317,7 @@ class WorkspaceManager {\nval rootModules = modules.getModules().values.filter { it.owner is SourceModuleOwner }\nval rootModuleIds = rootModules.map { it.moduleId }.toMutableSet()\nrootModuleIds += org_modelix_model_mpsplugin\n- val graph = GeneratorDependencyGraph(ModuleResolver(modules, ignoredModules))\n+ val graph = GeneratorDependencyGraph(ModuleResolver(modules, ignoredModules), additionalGenerationDependencies)\ngraph.load(rootModules)\nval modulesToLoad = graph.getNodes().flatMap { it.modules }.map { it.owner.getRootOwner() }.toSet()\n@@ -337,3 +350,8 @@ class WorkspaceManager {\nfun removeWorkspace(workspaceId: String) = workspacePersistence.removeWorkspace(workspaceId)\n}\n+private fun Workspace.additionalGenerationDependenciesAsMap(): Map<ModuleId, Set<ModuleId>> {\n+ return additionalGenerationDependencies\n+ .groupBy { ModuleId(it.from) }\n+ .mapValues { it.value.map { ModuleId(it.to) }.toSet() }\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "workspaces/src/main/kotlin/org/modelix/workspaces/Workspace.kt",
"new_path": "workspaces/src/main/kotlin/org/modelix/workspaces/Workspace.kt",
"diff": "@@ -32,7 +32,12 @@ data class Workspace(var id: String,\nval mavenRepositories: List<MavenRepository> = listOf(),\nvar mavenDependencies: List<String> = listOf(),\nval uploads: MutableList<String> = ArrayList(),\n- val ignoredModules: List<String> = ArrayList())\n+ val ignoredModules: List<String> = ArrayList(),\n+ val additionalGenerationDependencies: List<GenerationDependency> = ArrayList(),\n+)\n+\n+@Serializable\n+data class GenerationDependency(val from: String, val to: String)\n@JvmInline\nvalue class WorkspaceHash(val hash: String) {\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Allow specifying additional generation dependencies
If building a workspace fails because the build script generator
fails to find a dependency, this dependency can now be added inside the
workspace configuration. |
426,496 | 11.05.2022 14:56:53 | -7,200 | 2500c0d40d49825978e77de80b3a6a28f681453a | Fixed initial synchronization of a project to the model server in projector mode | [
{
"change_type": "MODIFY",
"old_path": "mps/org.modelix.model.metametamodel/generator/templates/org.modelix.model.metametamodel.generator.templates@generator.mps",
"new_path": "mps/org.modelix.model.metametamodel/generator/templates/org.modelix.model.metametamodel.generator.templates@generator.mps",
"diff": "<model ref=\"r:3e059775-23b2-4839-81c4-2e21615d2cf2(org.modelix.model.metametamodel.generator.templates@generator)\">\n<persistence version=\"9\" />\n<languages>\n+ <use id=\"d7706f63-9be2-479c-a3da-ae92af1e64d5\" name=\"jetbrains.mps.lang.generator.generationContext\" version=\"2\" />\n+ <use id=\"b401a680-8325-4110-8fd3-84331ff25bef\" name=\"jetbrains.mps.lang.generator\" version=\"3\" />\n<devkit ref=\"a2eb3a43-fcc2-4200-80dc-c60110c4862d(jetbrains.mps.devkit.templates)\" />\n</languages>\n<imports>\n"
},
{
"change_type": "MODIFY",
"old_path": "mps/org.modelix.model.mpsplugin/models/org.modelix.model.mpsplugin.mps",
"new_path": "mps/org.modelix.model.mpsplugin/models/org.modelix.model.mpsplugin.mps",
"diff": "<node concept=\"3cqZAl\" id=\"6aRQr1WPiWn\" role=\"3clF45\" />\n<node concept=\"3Tm1VV\" id=\"6aRQr1WPiWo\" role=\"1B3o_S\" />\n<node concept=\"3clFbS\" id=\"6aRQr1WPiWq\" role=\"3clF47\">\n+ <node concept=\"RRSsy\" id=\"z7ArF31OTg\" role=\"3cqZAp\">\n+ <node concept=\"3cpWs3\" id=\"z7ArF31QFe\" role=\"RRSoy\">\n+ <node concept=\"Xl_RD\" id=\"z7ArF31QR_\" role=\"3uHU7w\">\n+ <property role=\"Xl_RC\" value=\")\" />\n+ </node>\n+ <node concept=\"3cpWs3\" id=\"z7ArF31PIZ\" role=\"3uHU7B\">\n+ <node concept=\"Xl_RD\" id=\"z7ArF31CWp\" role=\"3uHU7B\">\n+ <property role=\"Xl_RC\" value=\"ModelServerConnection.init(\" />\n+ </node>\n+ <node concept=\"37vLTw\" id=\"z7ArF31PVq\" role=\"3uHU7w\">\n+ <ref role=\"3cqZAo\" node=\"6aRQr1WPiWt\" resolve=\"baseUrl\" />\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n<node concept=\"3clFbF\" id=\"7ZZZU$l7GqL\" role=\"3cqZAp\">\n<node concept=\"37vLTI\" id=\"7ZZZU$l7GqN\" role=\"3clFbG\">\n<node concept=\"2OqwBi\" id=\"7ZZZU$l7Gg$\" role=\"37vLTx\">\n</node>\n</node>\n</node>\n+ <node concept=\"RRSsy\" id=\"z7ArF31CWn\" role=\"3cqZAp\">\n+ <node concept=\"3cpWs3\" id=\"z7ArF31Nb_\" role=\"RRSoy\">\n+ <node concept=\"37vLTw\" id=\"z7ArF31O1N\" role=\"3uHU7w\">\n+ <ref role=\"3cqZAo\" node=\"6aRQr1WPbDO\" resolve=\"baseUrl\" />\n+ </node>\n+ <node concept=\"Xl_RD\" id=\"z7ArF31KW1\" role=\"3uHU7B\">\n+ <property role=\"Xl_RC\" value=\"connected to \" />\n+ </node>\n+ </node>\n+ </node>\n<node concept=\"3clFbF\" id=\"1JFLVobjn3O\" role=\"3cqZAp\">\n<node concept=\"37vLTI\" id=\"1JFLVobjnHJ\" role=\"3clFbG\">\n<node concept=\"3clFbT\" id=\"1JFLVobjnWr\" role=\"37vLTx\">\n"
},
{
"change_type": "MODIFY",
"old_path": "mps/org.modelix.model.mpsplugin/models/org.modelix.model.mpsplugin.plugin.mps",
"new_path": "mps/org.modelix.model.mpsplugin/models/org.modelix.model.mpsplugin.plugin.mps",
"diff": "<import index=\"hvt5\" ref=\"0a2651ab-f212-45c2-a2f0-343e76cbc26b/java:org.modelix.model(org.modelix.model.client/)\" />\n<import index=\"guwi\" ref=\"6354ebe7-c22a-4a0f-ac54-50b52ab9b065/java:java.io(JDK/)\" />\n<import index=\"71xd\" ref=\"742f6602-5a2f-4313-aa6e-ae1cd4ffdc61/java:jetbrains.mps.ide.tools(MPS.Platform/)\" implicit=\"true\" />\n- <import index=\"tprs\" ref=\"r:00000000-0000-4000-0000-011c895904a4(jetbrains.mps.ide.actions)\" implicit=\"true\" />\n<import index=\"tpcu\" ref=\"r:00000000-0000-4000-0000-011c89590282(jetbrains.mps.lang.core.behavior)\" implicit=\"true\" />\n+ <import index=\"tprs\" ref=\"r:00000000-0000-4000-0000-011c895904a4(jetbrains.mps.ide.actions)\" implicit=\"true\" />\n<import index=\"mk90\" ref=\"6ed54515-acc8-4d1e-a16c-9fd6cfe951ea/java:jetbrains.mps.progress(MPS.Core/)\" implicit=\"true\" />\n</imports>\n<registry>\n<reference id=\"2644386474300074837\" name=\"conceptDeclaration\" index=\"35c_gD\" />\n</concept>\n<concept id=\"6677504323281689838\" name=\"jetbrains.mps.lang.smodel.structure.SConceptType\" flags=\"in\" index=\"3bZ5Sz\" />\n- <concept id=\"1172008320231\" name=\"jetbrains.mps.lang.smodel.structure.Node_IsNotNullOperation\" flags=\"nn\" index=\"3x8VRR\" />\n<concept id=\"1140137987495\" name=\"jetbrains.mps.lang.smodel.structure.SNodeTypeCastExpression\" flags=\"nn\" index=\"1PxgMI\" />\n<concept id=\"1138055754698\" name=\"jetbrains.mps.lang.smodel.structure.SNodeType\" flags=\"in\" index=\"3Tqbb2\">\n<reference id=\"1138405853777\" name=\"concept\" index=\"ehGHo\" />\n<concept id=\"1172650591544\" name=\"jetbrains.mps.baseLanguage.collections.structure.SkipOperation\" flags=\"nn\" index=\"7r0gD\">\n<child id=\"1172658456740\" name=\"elementsToSkip\" index=\"7T0AP\" />\n</concept>\n+ <concept id=\"1204980550705\" name=\"jetbrains.mps.baseLanguage.collections.structure.VisitAllOperation\" flags=\"nn\" index=\"2es0OD\" />\n<concept id=\"1226511727824\" name=\"jetbrains.mps.baseLanguage.collections.structure.SetType\" flags=\"in\" index=\"2hMVRd\">\n<child id=\"1226511765987\" name=\"elementType\" index=\"2hN53Y\" />\n</concept>\n<concept id=\"1240687580870\" name=\"jetbrains.mps.baseLanguage.collections.structure.JoinOperation\" flags=\"nn\" index=\"3uJxvA\">\n<child id=\"1240687658305\" name=\"delimiter\" index=\"3uJOhx\" />\n</concept>\n+ <concept id=\"1165530316231\" name=\"jetbrains.mps.baseLanguage.collections.structure.IsEmptyOperation\" flags=\"nn\" index=\"1v1jN8\" />\n<concept id=\"1225727723840\" name=\"jetbrains.mps.baseLanguage.collections.structure.FindFirstOperation\" flags=\"nn\" index=\"1z4cxt\" />\n<concept id=\"1202120902084\" name=\"jetbrains.mps.baseLanguage.collections.structure.WhereOperation\" flags=\"nn\" index=\"3zZkjj\" />\n<concept id=\"1202128969694\" name=\"jetbrains.mps.baseLanguage.collections.structure.SelectOperation\" flags=\"nn\" index=\"3$u5V9\" />\n<node concept=\"3zACq4\" id=\"5Le8ZRJe6s$\" role=\"3cqZAp\" />\n</node>\n</node>\n+ <node concept=\"3KbdKl\" id=\"z7ArF30JwU\" role=\"3KbHQx\">\n+ <node concept=\"Rm8GO\" id=\"z7ArF30K2B\" role=\"3Kbmr1\">\n+ <ref role=\"Rm8GQ\" node=\"DOf0T7u4WT\" resolve=\"PROJECTOR\" />\n+ <ref role=\"1Px2BO\" node=\"5Le8ZRJdWor\" resolve=\"EModelixExecutionMode\" />\n+ </node>\n+ <node concept=\"3clFbS\" id=\"z7ArF30JwW\" role=\"3Kbo56\">\n+ <node concept=\"3clFbH\" id=\"z7ArF30JwY\" role=\"3cqZAp\" />\n+ <node concept=\"3zACq4\" id=\"z7ArF30JwZ\" role=\"3cqZAp\" />\n+ </node>\n+ </node>\n<node concept=\"3KbdKl\" id=\"5Le8ZRJe8VH\" role=\"3KbHQx\">\n<node concept=\"Rm8GO\" id=\"5Le8ZRJe9uY\" role=\"3Kbmr1\">\n<ref role=\"1Px2BO\" node=\"5Le8ZRJdWor\" resolve=\"EModelixExecutionMode\" />\n<node concept=\"3cqZAl\" id=\"4rrX99oiyDU\" role=\"3clF45\" />\n<node concept=\"3Tm1VV\" id=\"4rrX99oiyDV\" role=\"1B3o_S\" />\n<node concept=\"3clFbS\" id=\"4rrX99oiyDW\" role=\"3clF47\">\n+ <node concept=\"RRSsy\" id=\"z7ArF31H9g\" role=\"3cqZAp\">\n+ <node concept=\"Xl_RD\" id=\"z7ArF31H9h\" role=\"RRSoy\">\n+ <property role=\"Xl_RC\" value=\"AutoBindings.init\" />\n+ </node>\n+ </node>\n<node concept=\"3clFbF\" id=\"4rrX99oiB3B\" role=\"3cqZAp\">\n<node concept=\"37vLTI\" id=\"4rrX99oiC6y\" role=\"3clFbG\">\n<node concept=\"37vLTw\" id=\"4rrX99oiCFJ\" role=\"37vLTx\">\n<node concept=\"3cqZAl\" id=\"4rrX99oi_Me\" role=\"3clF45\" />\n<node concept=\"3Tm1VV\" id=\"4rrX99oi_Mf\" role=\"1B3o_S\" />\n<node concept=\"3clFbS\" id=\"4rrX99oi_Mh\" role=\"3clF47\">\n+ <node concept=\"RRSsy\" id=\"z7ArF31Hux\" role=\"3cqZAp\">\n+ <node concept=\"Xl_RD\" id=\"z7ArF31Huy\" role=\"RRSoy\">\n+ <property role=\"Xl_RC\" value=\"AutoBindings.repositoriesChanged\" />\n+ </node>\n+ </node>\n<node concept=\"3clFbF\" id=\"4rrX99olUox\" role=\"3cqZAp\">\n<node concept=\"1rXfSq\" id=\"4rrX99olUov\" role=\"3clFbG\">\n<ref role=\"37wK5l\" node=\"4rrX99olJcE\" resolve=\"subscribeToRepositories\" />\n<node concept=\"3cqZAl\" id=\"4rrX99oi_Zl\" role=\"3clF45\" />\n<node concept=\"3Tm1VV\" id=\"4rrX99oi_Zm\" role=\"1B3o_S\" />\n<node concept=\"3clFbS\" id=\"4rrX99oi_Zo\" role=\"3clF47\">\n+ <node concept=\"RRSsy\" id=\"z7ArF31CWn\" role=\"3cqZAp\">\n+ <node concept=\"Xl_RD\" id=\"z7ArF31CWp\" role=\"RRSoy\">\n+ <property role=\"Xl_RC\" value=\"AutoBindings.connectionStatusChanged\" />\n+ </node>\n+ </node>\n<node concept=\"3clFbF\" id=\"4rrX99om5rb\" role=\"3cqZAp\">\n<node concept=\"1rXfSq\" id=\"4rrX99om5r9\" role=\"3clFbG\">\n<ref role=\"37wK5l\" node=\"4rrX99olUMW\" resolve=\"subscribeToInfoBranches\" />\n<node concept=\"3cqZAl\" id=\"4rrX99ojhB1\" role=\"3clF45\" />\n<node concept=\"3Tmbuc\" id=\"4rrX99ojpC5\" role=\"1B3o_S\" />\n<node concept=\"3clFbS\" id=\"4rrX99ojhB3\" role=\"3clF47\">\n+ <node concept=\"RRSsy\" id=\"z7ArF31F29\" role=\"3cqZAp\">\n+ <node concept=\"Xl_RD\" id=\"z7ArF31F2a\" role=\"RRSoy\">\n+ <property role=\"Xl_RC\" value=\"AutoBindings.updateBindings\" />\n+ </node>\n+ </node>\n+ <node concept=\"3clFbH\" id=\"z7ArF31D2U\" role=\"3cqZAp\" />\n<node concept=\"3cpWs8\" id=\"7PIbTorpEjh\" role=\"3cqZAp\">\n<node concept=\"3cpWsn\" id=\"7PIbTorpEjk\" role=\"3cpWs9\">\n<property role=\"TrG5h\" value=\"allActiveBranches\" />\n<node concept=\"3clFbH\" id=\"7PIbTorpDB9\" role=\"3cqZAp\" />\n<node concept=\"2Gpval\" id=\"7PIbTorpehl\" role=\"3cqZAp\">\n<node concept=\"2GrKxI\" id=\"7PIbTorpehn\" role=\"2Gsz3X\">\n- <property role=\"TrG5h\" value=\"repo\" />\n+ <property role=\"TrG5h\" value=\"connection\" />\n</node>\n<node concept=\"3clFbS\" id=\"7PIbTorpehr\" role=\"2LFqv$\">\n+ <node concept=\"RRSsy\" id=\"z7ArF32bdC\" role=\"3cqZAp\">\n+ <node concept=\"3cpWs3\" id=\"z7ArF32csE\" role=\"RRSoy\">\n+ <node concept=\"2OqwBi\" id=\"z7ArF32dFb\" role=\"3uHU7w\">\n+ <node concept=\"2GrUjf\" id=\"z7ArF32daO\" role=\"2Oq$k0\">\n+ <ref role=\"2Gs0qQ\" node=\"7PIbTorpehn\" resolve=\"connection\" />\n+ </node>\n+ <node concept=\"liA8E\" id=\"z7ArF32eOR\" role=\"2OqNvi\">\n+ <ref role=\"37wK5l\" to=\"csg2:6aRQr1WQLS7\" resolve=\"getBaseUrl\" />\n+ </node>\n+ </node>\n+ <node concept=\"Xl_RD\" id=\"z7ArF32bdE\" role=\"3uHU7B\">\n+ <property role=\"Xl_RC\" value=\"update bindings for \" />\n+ </node>\n+ </node>\n+ </node>\n<node concept=\"3cpWs8\" id=\"7PIbTorpryy\" role=\"3cqZAp\">\n<node concept=\"3cpWsn\" id=\"7PIbTorpryz\" role=\"3cpWs9\">\n<property role=\"TrG5h\" value=\"repositories\" />\n</node>\n<node concept=\"2OqwBi\" id=\"6HlxtAUU_KC\" role=\"33vP2m\">\n<node concept=\"2GrUjf\" id=\"6HlxtAUU_KD\" role=\"2Oq$k0\">\n- <ref role=\"2Gs0qQ\" node=\"7PIbTorpehn\" resolve=\"repo\" />\n+ <ref role=\"2Gs0qQ\" node=\"7PIbTorpehn\" resolve=\"connection\" />\n</node>\n<node concept=\"liA8E\" id=\"6HlxtAUU_KE\" role=\"2OqNvi\">\n<ref role=\"37wK5l\" to=\"csg2:6aRQr1WVmiT\" resolve=\"getInfo\" />\n<ref role=\"37wK5l\" to=\"qvpu:~PArea.<init>(org.modelix.model.api.IBranch)\" resolve=\"PArea\" />\n<node concept=\"2OqwBi\" id=\"7PIbTorpry_\" role=\"37wK5m\">\n<node concept=\"2GrUjf\" id=\"7PIbTorpryA\" role=\"2Oq$k0\">\n- <ref role=\"2Gs0qQ\" node=\"7PIbTorpehn\" resolve=\"repo\" />\n+ <ref role=\"2Gs0qQ\" node=\"7PIbTorpehn\" resolve=\"connection\" />\n</node>\n<node concept=\"liA8E\" id=\"7PIbTorpryB\" role=\"2OqNvi\">\n<ref role=\"37wK5l\" to=\"csg2:6aRQr1X1RCt\" resolve=\"getInfoBranch\" />\n</node>\n</node>\n</node>\n+ <node concept=\"RRSsy\" id=\"z7ArF32hd_\" role=\"3cqZAp\">\n+ <node concept=\"3cpWs3\" id=\"z7ArF32irE\" role=\"RRSoy\">\n+ <node concept=\"2OqwBi\" id=\"z7ArF32k9l\" role=\"3uHU7w\">\n+ <node concept=\"37vLTw\" id=\"z7ArF32j9q\" role=\"2Oq$k0\">\n+ <ref role=\"3cqZAo\" node=\"7PIbTorpryz\" resolve=\"repositories\" />\n+ </node>\n+ <node concept=\"3$u5V9\" id=\"z7ArF32mh3\" role=\"2OqNvi\">\n+ <node concept=\"1bVj0M\" id=\"z7ArF32mh5\" role=\"23t8la\">\n+ <node concept=\"3clFbS\" id=\"z7ArF32mh6\" role=\"1bW5cS\">\n+ <node concept=\"3clFbF\" id=\"z7ArF32mJ8\" role=\"3cqZAp\">\n+ <node concept=\"2OqwBi\" id=\"z7ArF32mTY\" role=\"3clFbG\">\n+ <node concept=\"37vLTw\" id=\"z7ArF32mJ7\" role=\"2Oq$k0\">\n+ <ref role=\"3cqZAo\" node=\"z7ArF32mh7\" resolve=\"it\" />\n+ </node>\n+ <node concept=\"liA8E\" id=\"z7ArF32nvv\" role=\"2OqNvi\">\n+ <ref role=\"37wK5l\" to=\"xkhl:~RepositoryId.getId()\" resolve=\"getId\" />\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ <node concept=\"Rh6nW\" id=\"z7ArF32mh7\" role=\"1bW2Oz\">\n+ <property role=\"TrG5h\" value=\"it\" />\n+ <node concept=\"2jxLKc\" id=\"z7ArF32mh8\" role=\"1tU5fm\" />\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ <node concept=\"Xl_RD\" id=\"z7ArF32hdB\" role=\"3uHU7B\">\n+ <property role=\"Xl_RC\" value=\"using repositories: \" />\n+ </node>\n+ </node>\n+ </node>\n<node concept=\"2Gpval\" id=\"7PIbTorptgT\" role=\"3cqZAp\">\n<node concept=\"2GrKxI\" id=\"7PIbTorptgV\" role=\"2Gsz3X\">\n<property role=\"TrG5h\" value=\"repositoryId\" />\n</node>\n<node concept=\"2OqwBi\" id=\"7PIbTorpv$e\" role=\"33vP2m\">\n<node concept=\"2GrUjf\" id=\"7PIbTorpv$f\" role=\"2Oq$k0\">\n- <ref role=\"2Gs0qQ\" node=\"7PIbTorpehn\" resolve=\"repo\" />\n+ <ref role=\"2Gs0qQ\" node=\"7PIbTorpehn\" resolve=\"connection\" />\n</node>\n<node concept=\"liA8E\" id=\"7PIbTorpv$g\" role=\"2OqNvi\">\n<ref role=\"37wK5l\" to=\"csg2:6aRQr1X24wJ\" resolve=\"getActiveBranch\" />\n</node>\n</node>\n</node>\n+ <node concept=\"RRSsy\" id=\"z7ArF32p5L\" role=\"3cqZAp\">\n+ <node concept=\"3cpWs3\" id=\"z7ArF32rDp\" role=\"RRSoy\">\n+ <node concept=\"2OqwBi\" id=\"z7ArF32sRQ\" role=\"3uHU7w\">\n+ <node concept=\"37vLTw\" id=\"z7ArF32sna\" role=\"2Oq$k0\">\n+ <ref role=\"3cqZAo\" node=\"7PIbTorpv$d\" resolve=\"activeBranch\" />\n+ </node>\n+ <node concept=\"liA8E\" id=\"z7ArF32t7B\" role=\"2OqNvi\">\n+ <ref role=\"37wK5l\" to=\"5440:~ActiveBranch.getBranchName()\" resolve=\"getBranchName\" />\n+ </node>\n+ </node>\n+ <node concept=\"Xl_RD\" id=\"z7ArF32p5N\" role=\"3uHU7B\">\n+ <property role=\"Xl_RC\" value=\"using branch: \" />\n+ </node>\n+ </node>\n+ </node>\n<node concept=\"3clFbF\" id=\"7PIbTorpGRs\" role=\"3cqZAp\">\n<node concept=\"2OqwBi\" id=\"7PIbTorpI3y\" role=\"3clFbG\">\n<node concept=\"37vLTw\" id=\"7PIbTorpGRq\" role=\"2Oq$k0\">\n</node>\n</node>\n</node>\n+ <node concept=\"3cpWs8\" id=\"6Dx7QUa1LDd\" role=\"3cqZAp\">\n+ <node concept=\"3cpWsn\" id=\"6Dx7QUa1LDg\" role=\"3cpWs9\">\n+ <property role=\"TrG5h\" value=\"outsideRead\" />\n+ <node concept=\"_YKpA\" id=\"6Dx7QUa1LD9\" role=\"1tU5fm\">\n+ <node concept=\"1ajhzC\" id=\"6Dx7QUa1Nna\" role=\"_ZDj9\">\n+ <node concept=\"3cqZAl\" id=\"6Dx7QUa1NzG\" role=\"1ajl9A\" />\n+ </node>\n+ </node>\n+ <node concept=\"2ShNRf\" id=\"6Dx7QUa1OjU\" role=\"33vP2m\">\n+ <node concept=\"Tc6Ow\" id=\"6Dx7QUa1NWm\" role=\"2ShVmc\">\n+ <node concept=\"1ajhzC\" id=\"6Dx7QUa1NWn\" role=\"HW$YZ\">\n+ <node concept=\"3cqZAl\" id=\"6Dx7QUa1NWo\" role=\"1ajl9A\" />\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n<node concept=\"3clFbF\" id=\"7PIbTorpwv5\" role=\"3cqZAp\">\n<node concept=\"2OqwBi\" id=\"7PIbTorpwv6\" role=\"3clFbG\">\n<node concept=\"liA8E\" id=\"7PIbTorpwva\" role=\"2OqNvi\">\n<node concept=\"1bVj0M\" id=\"7PIbTorpwvb\" role=\"37wK5m\">\n<property role=\"3yWfEV\" value=\"true\" />\n<node concept=\"3clFbS\" id=\"7PIbTorpwvc\" role=\"1bW5cS\">\n+ <node concept=\"3cpWs8\" id=\"6Dx7QU9XlUv\" role=\"3cqZAp\">\n+ <node concept=\"3cpWsn\" id=\"6Dx7QU9XlUw\" role=\"3cpWs9\">\n+ <property role=\"TrG5h\" value=\"t\" />\n+ <node concept=\"3uibUv\" id=\"6Dx7QU9Xlzo\" role=\"1tU5fm\">\n+ <ref role=\"3uigEE\" to=\"jks5:~ITransaction\" resolve=\"ITransaction\" />\n+ </node>\n+ <node concept=\"2OqwBi\" id=\"6Dx7QU9XlUx\" role=\"33vP2m\">\n+ <node concept=\"2OqwBi\" id=\"6Dx7QU9XlUy\" role=\"2Oq$k0\">\n+ <node concept=\"37vLTw\" id=\"6Dx7QU9XlUz\" role=\"2Oq$k0\">\n+ <ref role=\"3cqZAo\" node=\"7PIbTorpv$d\" resolve=\"activeBranch\" />\n+ </node>\n+ <node concept=\"liA8E\" id=\"6Dx7QU9XlU$\" role=\"2OqNvi\">\n+ <ref role=\"37wK5l\" to=\"5440:~ActiveBranch.getBranch()\" resolve=\"getBranch\" />\n+ </node>\n+ </node>\n+ <node concept=\"liA8E\" id=\"6Dx7QU9XlU_\" role=\"2OqNvi\">\n+ <ref role=\"37wK5l\" to=\"jks5:~IBranch.getTransaction()\" resolve=\"getTransaction\" />\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n<node concept=\"3cpWs8\" id=\"1yReInPwQp\" role=\"3cqZAp\">\n<node concept=\"3cpWsn\" id=\"1yReInPwQq\" role=\"3cpWs9\">\n<property role=\"TrG5h\" value=\"allChildren_\" />\n</node>\n</node>\n<node concept=\"2OqwBi\" id=\"1yReInPwQr\" role=\"33vP2m\">\n- <node concept=\"2OqwBi\" id=\"1yReInPwQs\" role=\"2Oq$k0\">\n- <node concept=\"2OqwBi\" id=\"1yReInPwQt\" role=\"2Oq$k0\">\n- <node concept=\"37vLTw\" id=\"1yReInPwQu\" role=\"2Oq$k0\">\n- <ref role=\"3cqZAo\" node=\"7PIbTorpv$d\" resolve=\"activeBranch\" />\n- </node>\n- <node concept=\"liA8E\" id=\"1yReInPwQv\" role=\"2OqNvi\">\n- <ref role=\"37wK5l\" to=\"5440:~ActiveBranch.getBranch()\" resolve=\"getBranch\" />\n- </node>\n- </node>\n- <node concept=\"liA8E\" id=\"1yReInPwQw\" role=\"2OqNvi\">\n- <ref role=\"37wK5l\" to=\"jks5:~IBranch.getTransaction()\" resolve=\"getTransaction\" />\n- </node>\n+ <node concept=\"37vLTw\" id=\"6Dx7QU9XlUA\" role=\"2Oq$k0\">\n+ <ref role=\"3cqZAo\" node=\"6Dx7QU9XlUw\" resolve=\"t\" />\n</node>\n<node concept=\"liA8E\" id=\"1yReInPwQx\" role=\"2OqNvi\">\n<ref role=\"37wK5l\" to=\"jks5:~ITransaction.getAllChildren(long)\" resolve=\"getAllChildren\" />\n</node>\n</node>\n</node>\n- <node concept=\"3clFbJ\" id=\"3efAAvvqixZ\" role=\"3cqZAp\">\n- <node concept=\"3clFbS\" id=\"3efAAvvqiy1\" role=\"3clFbx\">\n+ <node concept=\"RRSsy\" id=\"z7ArF32yri\" role=\"3cqZAp\">\n+ <node concept=\"3cpWs3\" id=\"z7ArF32Bqr\" role=\"RRSoy\">\n+ <node concept=\"2OqwBi\" id=\"z7ArF32DDx\" role=\"3uHU7w\">\n+ <node concept=\"37vLTw\" id=\"z7ArF32CzH\" role=\"2Oq$k0\">\n+ <ref role=\"3cqZAo\" node=\"7ZZZU$kZuUd\" resolve=\"firstProject\" />\n+ </node>\n+ <node concept=\"2qgKlT\" id=\"z7ArF32EUY\" role=\"2OqNvi\">\n+ <ref role=\"37wK5l\" to=\"tpcu:hEwIO9y\" resolve=\"getFqName\" />\n+ </node>\n+ </node>\n+ <node concept=\"Xl_RD\" id=\"z7ArF32$mJ\" role=\"3uHU7B\">\n+ <property role=\"Xl_RC\" value=\"trying to bind project: \" />\n+ </node>\n+ </node>\n+ </node>\n<node concept=\"3clFbF\" id=\"7ZZZU$kZGEz\" role=\"3cqZAp\">\n<node concept=\"37vLTI\" id=\"7ZZZU$kZGE_\" role=\"3clFbG\">\n<node concept=\"2OqwBi\" id=\"7ZZZU$kZDEi\" role=\"37vLTx\">\n<node concept=\"3cpWsn\" id=\"7ZZZU$l0gcE\" role=\"3cpWs9\">\n<property role=\"TrG5h\" value=\"projectNodeId\" />\n<node concept=\"3cpWsb\" id=\"7ZZZU$l0gcF\" role=\"1tU5fm\" />\n- <node concept=\"2OqwBi\" id=\"7ZZZU$l0gcG\" role=\"33vP2m\">\n+ <node concept=\"3K4zz7\" id=\"6Dx7QUa0rYP\" role=\"33vP2m\">\n+ <node concept=\"1adDum\" id=\"6Dx7QUa0t3Y\" role=\"3K4E3e\">\n+ <property role=\"1adDun\" value=\"0L\" />\n+ </node>\n+ <node concept=\"3clFbC\" id=\"6Dx7QUa0qbC\" role=\"3K4Cdx\">\n+ <node concept=\"10Nm6u\" id=\"6Dx7QUa0qxW\" role=\"3uHU7w\" />\n+ <node concept=\"37vLTw\" id=\"6Dx7QUa0oYi\" role=\"3uHU7B\">\n+ <ref role=\"3cqZAo\" node=\"7ZZZU$kZuUd\" resolve=\"firstProject\" />\n+ </node>\n+ </node>\n+ <node concept=\"2OqwBi\" id=\"7ZZZU$l0gcG\" role=\"3K4GZi\">\n<node concept=\"1eOMI4\" id=\"7ZZZU$l0gcH\" role=\"2Oq$k0\">\n<node concept=\"10QFUN\" id=\"7ZZZU$l0gcI\" role=\"1eOMHV\">\n<node concept=\"2YIFZM\" id=\"7ZZZU$l0gcJ\" role=\"10QFUP\">\n</node>\n</node>\n</node>\n+ </node>\n<node concept=\"3cpWs8\" id=\"7ZZZU$l0pQq\" role=\"3cqZAp\">\n<node concept=\"3cpWsn\" id=\"7ZZZU$l0pQr\" role=\"3cpWs9\">\n<property role=\"TrG5h\" value=\"mpsProjects\" />\n</node>\n<node concept=\"3clFbJ\" id=\"7ZZZU$l0wJa\" role=\"3cqZAp\">\n<node concept=\"3clFbS\" id=\"7ZZZU$l0wJc\" role=\"3clFbx\">\n+ <node concept=\"RRSsy\" id=\"z7ArF32Hs8\" role=\"3cqZAp\">\n+ <node concept=\"3cpWs3\" id=\"z7ArF32J1M\" role=\"RRSoy\">\n+ <node concept=\"2OqwBi\" id=\"z7ArF32Mej\" role=\"3uHU7w\">\n+ <node concept=\"37vLTw\" id=\"z7ArF32Kdh\" role=\"2Oq$k0\">\n+ <ref role=\"3cqZAo\" node=\"7ZZZU$l0pQr\" resolve=\"mpsProjects\" />\n+ </node>\n+ <node concept=\"3$u5V9\" id=\"z7ArF32Pf8\" role=\"2OqNvi\">\n+ <node concept=\"1bVj0M\" id=\"z7ArF32Pfa\" role=\"23t8la\">\n+ <node concept=\"3clFbS\" id=\"z7ArF32Pfb\" role=\"1bW5cS\">\n+ <node concept=\"3clFbF\" id=\"z7ArF32Qlg\" role=\"3cqZAp\">\n+ <node concept=\"2OqwBi\" id=\"z7ArF32R6e\" role=\"3clFbG\">\n+ <node concept=\"37vLTw\" id=\"z7ArF32Qlf\" role=\"2Oq$k0\">\n+ <ref role=\"3cqZAo\" node=\"z7ArF32Pfc\" resolve=\"it\" />\n+ </node>\n+ <node concept=\"liA8E\" id=\"z7ArF32S7P\" role=\"2OqNvi\">\n+ <ref role=\"37wK5l\" to=\"z1c4:~Project.getName()\" resolve=\"getName\" />\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ <node concept=\"Rh6nW\" id=\"z7ArF32Pfc\" role=\"1bW2Oz\">\n+ <property role=\"TrG5h\" value=\"it\" />\n+ <node concept=\"2jxLKc\" id=\"z7ArF32Pfd\" role=\"1tU5fm\" />\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ <node concept=\"Xl_RD\" id=\"z7ArF32Hsa\" role=\"3uHU7B\">\n+ <property role=\"Xl_RC\" value=\"mps projects found: \" />\n+ </node>\n+ </node>\n+ </node>\n<node concept=\"3clFbJ\" id=\"7ZZZU$l30BT\" role=\"3cqZAp\">\n<node concept=\"3clFbS\" id=\"7ZZZU$l30BV\" role=\"3clFbx\">\n+ <node concept=\"RRSsy\" id=\"z7ArF32U5E\" role=\"3cqZAp\">\n+ <node concept=\"Xl_RD\" id=\"z7ArF32U5G\" role=\"RRSoy\">\n+ <property role=\"Xl_RC\" value=\"adding project binding\" />\n+ </node>\n+ </node>\n+ <node concept=\"3clFbJ\" id=\"6Dx7QU9XBBS\" role=\"3cqZAp\">\n+ <node concept=\"3clFbS\" id=\"6Dx7QU9XBBU\" role=\"3clFbx\">\n+ <node concept=\"RRSsy\" id=\"6Dx7QUa05hr\" role=\"3cqZAp\">\n+ <node concept=\"Xl_RD\" id=\"6Dx7QUa05ht\" role=\"RRSoy\">\n+ <property role=\"Xl_RC\" value=\"Server side project doesn't contain any modules\" />\n+ </node>\n+ </node>\n+ </node>\n+ <node concept=\"1Wc70l\" id=\"6Dx7QU9Y96H\" role=\"3clFbw\">\n+ <node concept=\"3y3z36\" id=\"6Dx7QUa1cki\" role=\"3uHU7B\">\n+ <node concept=\"37vLTw\" id=\"6Dx7QUa179Y\" role=\"3uHU7B\">\n+ <ref role=\"3cqZAo\" node=\"7ZZZU$l0gcE\" resolve=\"projectNodeId\" />\n+ </node>\n+ <node concept=\"1adDum\" id=\"6Dx7QUa1b3A\" role=\"3uHU7w\">\n+ <property role=\"1adDun\" value=\"0L\" />\n+ </node>\n+ </node>\n+ <node concept=\"2OqwBi\" id=\"6Dx7QU9XNcS\" role=\"3uHU7w\">\n+ <node concept=\"2OqwBi\" id=\"6Dx7QU9XEB8\" role=\"2Oq$k0\">\n+ <node concept=\"37vLTw\" id=\"6Dx7QU9XDeM\" role=\"2Oq$k0\">\n+ <ref role=\"3cqZAo\" node=\"7ZZZU$kZuUd\" resolve=\"firstProject\" />\n+ </node>\n+ <node concept=\"3Tsc0h\" id=\"6Dx7QU9XIrH\" role=\"2OqNvi\">\n+ <ref role=\"3TtcxE\" to=\"jh6v:3DfUugBU39C\" resolve=\"projectModules\" />\n+ </node>\n+ </node>\n+ <node concept=\"1v1jN8\" id=\"6Dx7QU9XTUw\" role=\"2OqNvi\" />\n+ </node>\n+ </node>\n+ </node>\n+ <node concept=\"3clFbF\" id=\"6Dx7QUa1Qii\" role=\"3cqZAp\">\n+ <node concept=\"2OqwBi\" id=\"6Dx7QUa1Swp\" role=\"3clFbG\">\n+ <node concept=\"37vLTw\" id=\"6Dx7QUa1Qig\" role=\"2Oq$k0\">\n+ <ref role=\"3cqZAo\" node=\"6Dx7QUa1LDg\" resolve=\"outsideRead\" />\n+ </node>\n+ <node concept=\"TSZUe\" id=\"6Dx7QUa1Wag\" role=\"2OqNvi\">\n+ <node concept=\"1bVj0M\" id=\"6Dx7QUa1X$t\" role=\"25WWJ7\">\n+ <property role=\"3yWfEV\" value=\"true\" />\n+ <node concept=\"3clFbS\" id=\"6Dx7QUa1X$v\" role=\"1bW5cS\">\n<node concept=\"3clFbF\" id=\"7ZZZU$kZQHS\" role=\"3cqZAp\">\n<node concept=\"2OqwBi\" id=\"7ZZZU$kZR9k\" role=\"3clFbG\">\n<node concept=\"2GrUjf\" id=\"7ZZZU$kZQHQ\" role=\"2Oq$k0\">\n- <ref role=\"2Gs0qQ\" node=\"7PIbTorpehn\" resolve=\"repo\" />\n+ <ref role=\"2Gs0qQ\" node=\"7PIbTorpehn\" resolve=\"connection\" />\n</node>\n<node concept=\"liA8E\" id=\"7ZZZU$kZSeg\" role=\"2OqNvi\">\n<ref role=\"37wK5l\" to=\"csg2:EMWAvBf_zL\" resolve=\"addBinding\" />\n<node concept=\"37vLTw\" id=\"7ZZZU$l0jOG\" role=\"37wK5m\">\n<ref role=\"3cqZAo\" node=\"7ZZZU$l0gcE\" resolve=\"projectNodeId\" />\n</node>\n- <node concept=\"Rm8GO\" id=\"y4L82EaOHB\" role=\"37wK5m\">\n- <ref role=\"Rm8GQ\" to=\"csg2:4_k_9wJhfRm\" resolve=\"TO_MPS\" />\n- <ref role=\"1Px2BO\" to=\"csg2:4_k_9wJhes5\" resolve=\"SyncDirection\" />\n+ <node concept=\"10Nm6u\" id=\"6Dx7QUa1wz5\" role=\"37wK5m\" />\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n</node>\n</node>\n</node>\n<node concept=\"3fqX7Q\" id=\"7ZZZU$l4PHx\" role=\"3clFbw\">\n<node concept=\"2OqwBi\" id=\"7ZZZU$l4PHz\" role=\"3fr31v\">\n<node concept=\"2GrUjf\" id=\"7ZZZU$l4PH$\" role=\"2Oq$k0\">\n- <ref role=\"2Gs0qQ\" node=\"7PIbTorpehn\" resolve=\"repo\" />\n+ <ref role=\"2Gs0qQ\" node=\"7PIbTorpehn\" resolve=\"connection\" />\n</node>\n<node concept=\"liA8E\" id=\"7ZZZU$l4PH_\" role=\"2OqNvi\">\n<ref role=\"37wK5l\" to=\"csg2:4eX7sil8qhJ\" resolve=\"hasProjectBinding\" />\n</node>\n<node concept=\"9aQIb\" id=\"7ZZZU$l2pI7\" role=\"9aQIa\">\n<node concept=\"3clFbS\" id=\"7ZZZU$l2pI8\" role=\"9aQI4\">\n+ <node concept=\"RRSsy\" id=\"z7ArF32uAT\" role=\"3cqZAp\">\n+ <node concept=\"Xl_RD\" id=\"z7ArF32uAV\" role=\"RRSoy\">\n+ <property role=\"Xl_RC\" value=\"no mps project found yet\" />\n+ </node>\n+ </node>\n<node concept=\"3clFbF\" id=\"7ZZZU$l2r7z\" role=\"3cqZAp\">\n<node concept=\"1rXfSq\" id=\"7ZZZU$l2sz7\" role=\"3clFbG\">\n<ref role=\"37wK5l\" node=\"4rrX99okXWz\" resolve=\"updateBindingsLater\" />\n</node>\n</node>\n</node>\n- <node concept=\"2OqwBi\" id=\"3efAAvvqkXg\" role=\"3clFbw\">\n- <node concept=\"37vLTw\" id=\"3efAAvvqjRI\" role=\"2Oq$k0\">\n- <ref role=\"3cqZAo\" node=\"7ZZZU$kZuUd\" resolve=\"firstProject\" />\n- </node>\n- <node concept=\"3x8VRR\" id=\"3efAAvvqma0\" role=\"2OqNvi\" />\n- </node>\n- </node>\n- </node>\n<node concept=\"37vLTw\" id=\"7ZZZU$kZIWS\" role=\"3clFbw\">\n<ref role=\"3cqZAo\" node=\"7ZZZU$kYUPv\" resolve=\"bindProjects\" />\n</node>\n</node>\n<node concept=\"2OqwBi\" id=\"7PIbTorpwvY\" role=\"3clFbw\">\n<node concept=\"2GrUjf\" id=\"7PIbTorp_nz\" role=\"2Oq$k0\">\n- <ref role=\"2Gs0qQ\" node=\"7PIbTorpehn\" resolve=\"repo\" />\n+ <ref role=\"2Gs0qQ\" node=\"7PIbTorpehn\" resolve=\"connection\" />\n</node>\n<node concept=\"liA8E\" id=\"7PIbTorpww2\" role=\"2OqNvi\">\n<ref role=\"37wK5l\" to=\"csg2:5D5xac1qIoP\" resolve=\"hasModuleBinding\" />\n</node>\n</node>\n</node>\n+ <node concept=\"3clFbF\" id=\"6Dx7QUa236u\" role=\"3cqZAp\">\n+ <node concept=\"2OqwBi\" id=\"6Dx7QUa25kd\" role=\"3clFbG\">\n+ <node concept=\"37vLTw\" id=\"6Dx7QUa236s\" role=\"2Oq$k0\">\n+ <ref role=\"3cqZAo\" node=\"6Dx7QUa1LDg\" resolve=\"outsideRead\" />\n+ </node>\n+ <node concept=\"TSZUe\" id=\"6Dx7QUa28Zc\" role=\"2OqNvi\">\n+ <node concept=\"1bVj0M\" id=\"6Dx7QUa2aPb\" role=\"25WWJ7\">\n+ <property role=\"3yWfEV\" value=\"true\" />\n+ <node concept=\"3clFbS\" id=\"6Dx7QUa2aPd\" role=\"1bW5cS\">\n<node concept=\"3clFbF\" id=\"7PIbTorpww5\" role=\"3cqZAp\">\n<node concept=\"2OqwBi\" id=\"7PIbTorpww6\" role=\"3clFbG\">\n<node concept=\"2GrUjf\" id=\"7PIbTorpww7\" role=\"2Oq$k0\">\n- <ref role=\"2Gs0qQ\" node=\"7PIbTorpehn\" resolve=\"repo\" />\n+ <ref role=\"2Gs0qQ\" node=\"7PIbTorpehn\" resolve=\"connection\" />\n</node>\n<node concept=\"liA8E\" id=\"7PIbTorpww8\" role=\"2OqNvi\">\n<ref role=\"37wK5l\" to=\"csg2:EMWAvBf_zL\" resolve=\"addBinding\" />\n</node>\n</node>\n</node>\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n<node concept=\"3cpWs6\" id=\"1yReInPwv5\" role=\"3cqZAp\">\n<node concept=\"10M0yZ\" id=\"1yReInPwv6\" role=\"3cqZAk\">\n<ref role=\"1PxDUh\" to=\"v18h:~Unit\" resolve=\"Unit\" />\n</node>\n</node>\n</node>\n+ <node concept=\"3clFbF\" id=\"6Dx7QUa2gw0\" role=\"3cqZAp\">\n+ <node concept=\"2OqwBi\" id=\"6Dx7QUa2iNm\" role=\"3clFbG\">\n+ <node concept=\"37vLTw\" id=\"6Dx7QUa2gvY\" role=\"2Oq$k0\">\n+ <ref role=\"3cqZAo\" node=\"6Dx7QUa1LDg\" resolve=\"outsideRead\" />\n+ </node>\n+ <node concept=\"2es0OD\" id=\"6Dx7QUa2liy\" role=\"2OqNvi\">\n+ <node concept=\"1bVj0M\" id=\"6Dx7QUa2li$\" role=\"23t8la\">\n+ <node concept=\"3clFbS\" id=\"6Dx7QUa2li_\" role=\"1bW5cS\">\n+ <node concept=\"3clFbF\" id=\"6Dx7QUa2lNt\" role=\"3cqZAp\">\n+ <node concept=\"2OqwBi\" id=\"6Dx7QUa2lSk\" role=\"3clFbG\">\n+ <node concept=\"37vLTw\" id=\"6Dx7QUa2lNs\" role=\"2Oq$k0\">\n+ <ref role=\"3cqZAo\" node=\"6Dx7QUa2liA\" resolve=\"it\" />\n+ </node>\n+ <node concept=\"1Bd96e\" id=\"6Dx7QUa2m7g\" role=\"2OqNvi\" />\n+ </node>\n+ </node>\n+ </node>\n+ <node concept=\"Rh6nW\" id=\"6Dx7QUa2liA\" role=\"1bW2Oz\">\n+ <property role=\"TrG5h\" value=\"it\" />\n+ <node concept=\"2jxLKc\" id=\"6Dx7QUa2liB\" role=\"1tU5fm\" />\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n</node>\n</node>\n</node>\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Fixed initial synchronization of a project to the model server in projector mode |
426,496 | 16.05.2022 13:56:04 | -7,200 | 9628e420f8f74a08310ecd1dc27856ab9f2246d3 | Support diff view for git repositories stored in uploaded zip files | [
{
"change_type": "MODIFY",
"old_path": "workspace-manager/src/main/kotlin/org/modelix/workspace/manager/WorkspaceManagerModule.kt",
"new_path": "workspace-manager/src/main/kotlin/org/modelix/workspace/manager/WorkspaceManagerModule.kt",
"diff": "@@ -29,7 +29,6 @@ import kotlinx.serialization.encodeToString\nimport org.apache.commons.io.FileUtils\nimport org.apache.commons.text.StringEscapeUtils\nimport org.modelix.gitui.GIT_REPO_DIR_ATTRIBUTE_KEY\n-import org.modelix.gitui.Gitui\nimport org.modelix.gitui.MPS_INSTANCE_URL_ATTRIBUTE_KEY\nimport org.modelix.gitui.gitui\nimport org.modelix.workspaces.Workspace\n@@ -97,6 +96,13 @@ fun Application.workspaceManagerModule() {\ntext(\"Git History\" + suffix)\n}\n}\n+ workspace.uploads.associateWith { findGitRepo(manager.getUploadFolder(it)) }\n+ .filter { it.value != null }.forEach { upload ->\n+ a {\n+ href = \"$workspaceId/git/u${upload.key}/\"\n+ text(\"Git History\")\n+ }\n+ }\n}\ntd {\npostForm(\"./remove-workspace\") {\n@@ -206,6 +212,14 @@ fun Application.workspaceManagerModule() {\ntext(\"Git History\" + suffix)\n}\n}\n+ workspace.uploads.associateWith { findGitRepo(manager.getUploadFolder(it)) }\n+ .filter { it.value != null }.forEach { upload ->\n+ a {\n+ style = \"margin-left: 24px\"\n+ href = \"git/u${upload.key}/\"\n+ text(\"Git History\")\n+ }\n+ }\n}\nbr()\ndiv {\n@@ -599,16 +613,25 @@ fun Application.workspaceManagerModule() {\ncall.respondRedirect(\".\")\n}\n- route(\"{workspaceId}/git/{repoIndex}/\") {\n+ route(\"{workspaceId}/git/{repoOrUploadIndex}/\") {\nintercept(ApplicationCallPipeline.Call) {\nval workspaceId = call.parameters[\"workspaceId\"]!!\n- val repoIndex = call.parameters[\"repoIndex\"]!!.toInt()\n+ val repoOrUploadIndex = call.parameters[\"repoOrUploadIndex\"]!!\n+ var repoIndex: Int? = null\n+ var uploadId: String? = null\n+ if (repoOrUploadIndex.startsWith(\"u\")) {\n+ uploadId = repoOrUploadIndex.drop(1)\n+ } else {\n+ repoIndex = repoOrUploadIndex.toInt()\n+ }\nval workspaceAndHash = manager.getWorkspaceForId(workspaceId)\nif (workspaceAndHash == null) {\ncall.respondText(\"Workspace $workspaceId not found\", ContentType.Text.Plain, HttpStatusCode.NotFound)\nreturn@intercept\n}\nval (workspace, workspaceHash) = workspaceAndHash\n+ val repoDir: File\n+ if (repoIndex != null) {\nval repos = workspace.gitRepositories\nif (!repos.indices.contains(repoIndex)) {\ncall.respondText(\"Git repository with index $repoIndex doesn't exist\", ContentType.Text.Plain, HttpStatusCode.NotFound)\n@@ -619,7 +642,25 @@ fun Application.workspaceManagerModule() {\nif (!repoManager.repoDirectory.exists()) {\nrepoManager.updateRepo()\n}\n- call.attributes.put(GIT_REPO_DIR_ATTRIBUTE_KEY, repoManager.repoDirectory)\n+ repoDir = repoManager.repoDirectory\n+ } else {\n+ val uploadFolder = manager.getUploadFolder(uploadId!!)\n+ if (!uploadFolder.exists()) {\n+ call.respondText(\"Upload $uploadId doesn't exist\", ContentType.Text.Plain, HttpStatusCode.NotFound)\n+ return@intercept\n+ }\n+ if (uploadFolder.resolve(\".git\").exists()) {\n+ repoDir = uploadFolder\n+ } else {\n+ val repoDirFromUpload = findGitRepo(uploadFolder)\n+ if (repoDirFromUpload == null) {\n+ call.respondText(\"No git repository found in upload $uploadId\", ContentType.Text.Plain, HttpStatusCode.NotFound)\n+ return@intercept\n+ }\n+ repoDir = repoDirFromUpload\n+ }\n+ }\n+ call.attributes.put(GIT_REPO_DIR_ATTRIBUTE_KEY, repoDir)\ncall.attributes.put(MPS_INSTANCE_URL_ATTRIBUTE_KEY, \"../../../../workspace-${workspace.id}-$workspaceHash/\")\n}\ngitui()\n@@ -635,3 +676,14 @@ fun Application.workspaceManagerModule() {\nmethod(HttpMethod.Post)\n}\n}\n+\n+private fun findGitRepo(folder: File): File? {\n+ if (!folder.exists()) return null\n+ if (folder.name == \".git\") return folder.parentFile\n+ if (folder.resolve(\".git\").exists()) return folder.resolve(\".git\")\n+ val children = (folder.listFiles() ?: emptyArray())\n+ if (children.size == 1) {\n+ return findGitRepo(children[0])\n+ }\n+ return null\n+}\n\\ No newline at end of file\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Support diff view for git repositories stored in uploaded zip files |
426,496 | 17.05.2022 18:35:29 | -7,200 | 5b7a884a45fd2c9bf8c051d3b8408cb285ab7dd7 | Include only those modules in the workspace.zip that are actually used
This reduces the memory required by the MPS instance | [
{
"change_type": "MODIFY",
"old_path": "workspace-manager/src/main/kotlin/org/modelix/workspace/manager/WorkspaceManager.kt",
"new_path": "workspace-manager/src/main/kotlin/org/modelix/workspace/manager/WorkspaceManager.kt",
"diff": "@@ -176,17 +176,37 @@ class WorkspaceManager {\n}\nbuildScriptGenerator.buildModules(File(getWorkspaceDirectory(workspace), \"mps-build-script.xml\"), job.outputHandler)\n}\n+\n+ // to reduce the required memory include only those modules in the zip that are actually used\n+ val resolver = ModuleResolver(modulesMiner.getModules(), workspace.ignoredModules.map { ModuleId(it) }.toSet(), true)\n+ val graph = PublicationDependencyGraph(resolver)\n+ graph.load(modulesMiner.getModules().getModules().values)\n+ val sourceModules: Set<ModuleId> = modulesMiner.getModules().getModules()\n+ .filter { it.value.owner is SourceModuleOwner }.keys -\n+ workspace.ignoredModules.map { ModuleId(it) }.toSet()\n+ val transitiveDependencies = HashSet<DependencyGraph<FoundModule, ModuleId>.DependencyNode>()\n+ sourceModules.mapNotNull { graph.getNode(it) }.forEach {\n+ it.getTransitiveDependencies(transitiveDependencies)\n+ transitiveDependencies += it\n+ }\n+ val usedModuleOwners = transitiveDependencies.flatMap { it.modules }.map { it.owner }.toSet()\n+ val includedFolders = usedModuleOwners.map { it.path.getLocalAbsolutePath() }.toSet()\n+\ndownloadFile.parentFile.mkdirs()\nFileOutputStream(downloadFile).use { fileStream ->\nZipOutputStream(fileStream).use { zipStream ->\n+ job.outputHandler(\"Included Folders: \")\n+ includedFolders.forEach { job.outputHandler(\" $it\") }\n+ val usedModulesOnly: (Path) -> Boolean = { path -> path.ancestorsAndSelf().any { includedFolders.contains(it) } }\nmavenFolders.forEach {\n- zipStream.copyFiles(it, mapPath = { workspacePath.relativize(it)})\n+ zipStream.copyFiles(it, filter = usedModulesOnly, mapPath = { workspacePath.relativize(it)})\n}\ngitManagers.forEach { repo ->\n+ // no filter required because git repositories usually contain only source modules\nrepo.second.zip(repo.first.paths, zipStream, includeGitDir = true)\n}\nworkspace.uploads.forEach { uploadId ->\n- zipStream.copyFiles(getUploadFolder(uploadId), mapPath = {directory.toPath().relativize(it)})\n+ zipStream.copyFiles(getUploadFolder(uploadId), filter = usedModulesOnly, mapPath = {directory.toPath().relativize(it)})\n}\nif (modulesXml != null) {\nval zipEntry = ZipEntry(\"modules.xml\")\n@@ -355,3 +375,13 @@ private fun Workspace.additionalGenerationDependenciesAsMap(): Map<ModuleId, Set\n.groupBy { ModuleId(it.from) }\n.mapValues { it.value.map { ModuleId(it.to) }.toSet() }\n}\n+\n+private fun Path.ancestorsAndSelf(): Sequence<Path> {\n+ return sequence {\n+ var current: Path? = [email protected]()\n+ while (current != null) {\n+ yield(current)\n+ current = current.parent\n+ }\n+ }\n+}\n\\ No newline at end of file\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Include only those modules in the workspace.zip that are actually used
This reduces the memory required by the MPS instance |
426,496 | 18.05.2022 08:48:46 | -7,200 | 81a3d2aee6c6a9cdc9ead4798a4facbabd9cc04f | Fixed "No serializer found for SerializedNodeReference" | [
{
"change_type": "MODIFY",
"old_path": "model-client/src/commonMain/kotlin/org/modelix/model/lazy/INodeReferenceSerializer.kt",
"new_path": "model-client/src/commonMain/kotlin/org/modelix/model/lazy/INodeReferenceSerializer.kt",
"diff": "package org.modelix.model.lazy\nimport org.modelix.model.api.INodeReference\n+import org.modelix.model.persistent.SerializedNodeReference\ninterface INodeReferenceSerializer {\n@@ -34,6 +35,7 @@ interface INodeReferenceSerializer {\n}\nfun serialize(ref: INodeReference): String {\n+ if (ref is SerializedNodeReference) return ref.serialized\nreturn serializers.map { it.serialize(ref) }.firstOrNull { it != null }\n?: throw RuntimeException(\"No serializer found for ${ref::class}\")\n}\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Fixed "No serializer found for SerializedNodeReference" |
426,496 | 18.05.2022 08:54:10 | -7,200 | 5864b624ab7f88b3146adfcb76098bd7b8148a59 | If only used modules are loaded is now configurable in the workspace | [
{
"change_type": "MODIFY",
"old_path": "workspace-manager/src/main/kotlin/org/modelix/workspace/manager/WorkspaceManager.kt",
"new_path": "workspace-manager/src/main/kotlin/org/modelix/workspace/manager/WorkspaceManager.kt",
"diff": "@@ -177,6 +177,8 @@ class WorkspaceManager {\nbuildScriptGenerator.buildModules(File(getWorkspaceDirectory(workspace), \"mps-build-script.xml\"), job.outputHandler)\n}\n+ var fileFilter: (Path) -> Boolean = { true }\n+ if (workspace.loadUsedModulesOnly) {\n// to reduce the required memory include only those modules in the zip that are actually used\nval resolver = ModuleResolver(modulesMiner.getModules(), workspace.ignoredModules.map { ModuleId(it) }.toSet(), true)\nval graph = PublicationDependencyGraph(resolver)\n@@ -191,22 +193,24 @@ class WorkspaceManager {\n}\nval usedModuleOwners = transitiveDependencies.flatMap { it.modules }.map { it.owner }.toSet()\nval includedFolders = usedModuleOwners.map { it.path.getLocalAbsolutePath() }.toSet()\n+ //job.outputHandler(\"Included Folders: \")\n+ //includedFolders.sorted().forEach { job.outputHandler(\" $it\") }\n+ val usedModulesOnly: (Path) -> Boolean = { path -> path.ancestorsAndSelf().any { includedFolders.contains(it) } }\n+ fileFilter = usedModulesOnly\n+ }\ndownloadFile.parentFile.mkdirs()\nFileOutputStream(downloadFile).use { fileStream ->\nZipOutputStream(fileStream).use { zipStream ->\n- job.outputHandler(\"Included Folders: \")\n- includedFolders.forEach { job.outputHandler(\" $it\") }\n- val usedModulesOnly: (Path) -> Boolean = { path -> path.ancestorsAndSelf().any { includedFolders.contains(it) } }\nmavenFolders.forEach {\n- zipStream.copyFiles(it, filter = usedModulesOnly, mapPath = { workspacePath.relativize(it)})\n+ zipStream.copyFiles(it, filter = fileFilter, mapPath = { workspacePath.relativize(it)})\n}\ngitManagers.forEach { repo ->\n// no filter required because git repositories usually contain only source modules\nrepo.second.zip(repo.first.paths, zipStream, includeGitDir = true)\n}\nworkspace.uploads.forEach { uploadId ->\n- zipStream.copyFiles(getUploadFolder(uploadId), filter = usedModulesOnly, mapPath = {directory.toPath().relativize(it)})\n+ zipStream.copyFiles(getUploadFolder(uploadId), filter = fileFilter, mapPath = {directory.toPath().relativize(it)})\n}\nif (modulesXml != null) {\nval zipEntry = ZipEntry(\"modules.xml\")\n"
},
{
"change_type": "MODIFY",
"old_path": "workspaces/src/main/kotlin/org/modelix/workspaces/Workspace.kt",
"new_path": "workspaces/src/main/kotlin/org/modelix/workspaces/Workspace.kt",
"diff": "@@ -34,6 +34,7 @@ data class Workspace(var id: String,\nval uploads: MutableList<String> = ArrayList(),\nval ignoredModules: List<String> = ArrayList(),\nval additionalGenerationDependencies: List<GenerationDependency> = ArrayList(),\n+ val loadUsedModulesOnly: Boolean = true\n)\n@Serializable\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | If only used modules are loaded is now configurable in the workspace |
426,504 | 18.05.2022 10:21:12 | -7,200 | bdc5c859654dd524aec80ba32858c0059cd95810 | resolve broken references after updating MPS extensions | [
{
"change_type": "MODIFY",
"old_path": "mps/org.modelix.model.mpsplugin/models/org.modelix.model.mpsplugin.mps",
"new_path": "mps/org.modelix.model.mpsplugin/models/org.modelix.model.mpsplugin.mps",
"diff": "<property role=\"TrG5h\" value=\"dependenciesInMPS\" />\n<node concept=\"_YKpA\" id=\"ON_jCg8eo7\" role=\"1tU5fm\">\n<node concept=\"3uibUv\" id=\"ON_jCg8eo8\" role=\"_ZDj9\">\n- <ref role=\"3uigEE\" to=\"xxte:25OQfQHQeBK\" resolve=\"LanguageDependencyAsNode\" />\n+ <ref role=\"3uigEE\" to=\"xxte:25OQfQHQeBK\" resolve=\"SingleLanguageDependencyAsNode\" />\n</node>\n</node>\n<node concept=\"2OqwBi\" id=\"ON_jCg8eo9\" role=\"33vP2m\">\n<ref role=\"37wK5l\" to=\"xxte:25OQfQHQeFB\" resolve=\"getPropertyValue\" />\n<node concept=\"2OqwBi\" id=\"ON_jCg8epq\" role=\"37wK5m\">\n<node concept=\"355D3s\" id=\"ON_jCg8epr\" role=\"2Oq$k0\">\n- <ref role=\"355D3t\" to=\"jh6v:1UvRDkPap5X\" resolve=\"LanguageDependency\" />\n- <ref role=\"355D3u\" to=\"jh6v:1UvRDkPap5Y\" resolve=\"uuid\" />\n+ <ref role=\"355D3t\" to=\"jh6v:1UvRDkPap5X\" resolve=\"SingleLanguageDependency\" />\n+ <ref role=\"355D3u\" to=\"jh6v:7LiskgSqGCi\" resolve=\"uuid\" />\n</node>\n<node concept=\"liA8E\" id=\"ON_jCg8eps\" role=\"2OqNvi\">\n<ref role=\"37wK5l\" to=\"c17a:~SProperty.getName()\" resolve=\"getName\" />\n<ref role=\"37wK5l\" to=\"jks5:~INode.getPropertyValue(java.lang.String)\" resolve=\"getPropertyValue\" />\n<node concept=\"2OqwBi\" id=\"ON_jCg8epw\" role=\"37wK5m\">\n<node concept=\"355D3s\" id=\"ON_jCg8epx\" role=\"2Oq$k0\">\n- <ref role=\"355D3t\" to=\"jh6v:1UvRDkPap5X\" resolve=\"LanguageDependency\" />\n- <ref role=\"355D3u\" to=\"jh6v:1UvRDkPap5Y\" resolve=\"uuid\" />\n+ <ref role=\"355D3t\" to=\"jh6v:1UvRDkPap5X\" resolve=\"SingleLanguageDependency\" />\n+ <ref role=\"355D3u\" to=\"jh6v:7LiskgSqGCi\" resolve=\"uuid\" />\n</node>\n<node concept=\"liA8E\" id=\"ON_jCg8epy\" role=\"2OqNvi\">\n<ref role=\"37wK5l\" to=\"c17a:~SProperty.getName()\" resolve=\"getName\" />\n<ref role=\"2Gs0qQ\" node=\"ON_jCg8epa\" resolve=\"dependencyInMPS\" />\n</node>\n<node concept=\"355D3s\" id=\"ON_jCg8epT\" role=\"37wK5m\">\n- <ref role=\"355D3t\" to=\"jh6v:1UvRDkPap5X\" resolve=\"LanguageDependency\" />\n- <ref role=\"355D3u\" to=\"jh6v:1UvRDkPap60\" resolve=\"name\" />\n+ <ref role=\"355D3t\" to=\"jh6v:1UvRDkPap5X\" resolve=\"SingleLanguageDependency\" />\n+ <ref role=\"355D3u\" to=\"jh6v:7LiskgSqGCj\" resolve=\"name\" />\n</node>\n</node>\n</node>\n<ref role=\"2Gs0qQ\" node=\"ON_jCg8epa\" resolve=\"dependencyInMPS\" />\n</node>\n<node concept=\"355D3s\" id=\"ON_jCg8epZ\" role=\"37wK5m\">\n- <ref role=\"355D3t\" to=\"jh6v:1UvRDkPap5X\" resolve=\"LanguageDependency\" />\n+ <ref role=\"355D3t\" to=\"jh6v:1UvRDkPap5X\" resolve=\"SingleLanguageDependency\" />\n<ref role=\"355D3u\" to=\"jh6v:1UvRDkPap63\" resolve=\"version\" />\n</node>\n</node>\n<ref role=\"37wK5l\" to=\"jks5:~INode.getPropertyValue(java.lang.String)\" resolve=\"getPropertyValue\" />\n<node concept=\"2OqwBi\" id=\"ON_jCg8eqs\" role=\"37wK5m\">\n<node concept=\"355D3s\" id=\"ON_jCg8eqt\" role=\"2Oq$k0\">\n- <ref role=\"355D3t\" to=\"jh6v:1UvRDkPap5X\" resolve=\"LanguageDependency\" />\n- <ref role=\"355D3u\" to=\"jh6v:1UvRDkPap5Y\" resolve=\"uuid\" />\n+ <ref role=\"355D3t\" to=\"jh6v:1UvRDkPap5X\" resolve=\"SingleLanguageDependency\" />\n+ <ref role=\"355D3u\" to=\"jh6v:7LiskgSqGCi\" resolve=\"uuid\" />\n</node>\n<node concept=\"liA8E\" id=\"ON_jCg8equ\" role=\"2OqNvi\">\n<ref role=\"37wK5l\" to=\"c17a:~SProperty.getName()\" resolve=\"getName\" />\n<ref role=\"37wK5l\" to=\"jks5:~INode.getPropertyValue(java.lang.String)\" resolve=\"getPropertyValue\" />\n<node concept=\"2OqwBi\" id=\"ON_jCg8eqy\" role=\"37wK5m\">\n<node concept=\"355D3s\" id=\"ON_jCg8eqz\" role=\"2Oq$k0\">\n- <ref role=\"355D3t\" to=\"jh6v:1UvRDkPap5X\" resolve=\"LanguageDependency\" />\n- <ref role=\"355D3u\" to=\"jh6v:1UvRDkPap5Y\" resolve=\"uuid\" />\n+ <ref role=\"355D3t\" to=\"jh6v:1UvRDkPap5X\" resolve=\"SingleLanguageDependency\" />\n+ <ref role=\"355D3u\" to=\"jh6v:7LiskgSqGCi\" resolve=\"uuid\" />\n</node>\n<node concept=\"liA8E\" id=\"ON_jCg8eq$\" role=\"2OqNvi\">\n<ref role=\"37wK5l\" to=\"c17a:~SProperty.getName()\" resolve=\"getName\" />\n<property role=\"TrG5h\" value=\"dependenciesInMPS\" />\n<node concept=\"_YKpA\" id=\"ON_jCgb8EP\" role=\"1tU5fm\">\n<node concept=\"3uibUv\" id=\"ON_jCgb8EQ\" role=\"_ZDj9\">\n- <ref role=\"3uigEE\" to=\"xxte:25OQfQHQeBK\" resolve=\"LanguageDependencyAsNode\" />\n+ <ref role=\"3uigEE\" to=\"xxte:25OQfQHQeBK\" resolve=\"SingleLanguageDependencyAsNode\" />\n</node>\n</node>\n<node concept=\"2OqwBi\" id=\"ON_jCgb8ER\" role=\"33vP2m\">\n<ref role=\"37wK5l\" to=\"jks5:~INode.getPropertyValue(java.lang.String)\" resolve=\"getPropertyValue\" />\n<node concept=\"2OqwBi\" id=\"ON_jCgb8G8\" role=\"37wK5m\">\n<node concept=\"355D3s\" id=\"ON_jCgb8G9\" role=\"2Oq$k0\">\n- <ref role=\"355D3t\" to=\"jh6v:1UvRDkPap5X\" resolve=\"LanguageDependency\" />\n- <ref role=\"355D3u\" to=\"jh6v:1UvRDkPap5Y\" resolve=\"uuid\" />\n+ <ref role=\"355D3t\" to=\"jh6v:1UvRDkPap5X\" resolve=\"SingleLanguageDependency\" />\n+ <ref role=\"355D3u\" to=\"jh6v:7LiskgSqGCi\" resolve=\"uuid\" />\n</node>\n<node concept=\"liA8E\" id=\"ON_jCgb8Ga\" role=\"2OqNvi\">\n<ref role=\"37wK5l\" to=\"c17a:~SProperty.getName()\" resolve=\"getName\" />\n<ref role=\"37wK5l\" to=\"xxte:25OQfQHQeFB\" resolve=\"getPropertyValue\" />\n<node concept=\"2OqwBi\" id=\"ON_jCgb8Ge\" role=\"37wK5m\">\n<node concept=\"355D3s\" id=\"ON_jCgb8Gf\" role=\"2Oq$k0\">\n- <ref role=\"355D3t\" to=\"jh6v:1UvRDkPap5X\" resolve=\"LanguageDependency\" />\n- <ref role=\"355D3u\" to=\"jh6v:1UvRDkPap5Y\" resolve=\"uuid\" />\n+ <ref role=\"355D3t\" to=\"jh6v:1UvRDkPap5X\" resolve=\"SingleLanguageDependency\" />\n+ <ref role=\"355D3u\" to=\"jh6v:7LiskgSqGCi\" resolve=\"uuid\" />\n</node>\n<node concept=\"liA8E\" id=\"ON_jCgb8Gg\" role=\"2OqNvi\">\n<ref role=\"37wK5l\" to=\"c17a:~SProperty.getName()\" resolve=\"getName\" />\n<ref role=\"2Gs0qQ\" node=\"ON_jCgb8FS\" resolve=\"dependencyInCloud\" />\n</node>\n<node concept=\"355D3s\" id=\"ON_jCgb8GB\" role=\"37wK5m\">\n- <ref role=\"355D3t\" to=\"jh6v:1UvRDkPap5X\" resolve=\"LanguageDependency\" />\n- <ref role=\"355D3u\" to=\"jh6v:1UvRDkPap60\" resolve=\"name\" />\n+ <ref role=\"355D3t\" to=\"jh6v:1UvRDkPap5X\" resolve=\"SingleLanguageDependency\" />\n+ <ref role=\"355D3u\" to=\"jh6v:7LiskgSqGCj\" resolve=\"name\" />\n</node>\n</node>\n</node>\n<ref role=\"2Gs0qQ\" node=\"ON_jCgb8FS\" resolve=\"dependencyInCloud\" />\n</node>\n<node concept=\"355D3s\" id=\"ON_jCgb8GH\" role=\"37wK5m\">\n- <ref role=\"355D3t\" to=\"jh6v:1UvRDkPap5X\" resolve=\"LanguageDependency\" />\n+ <ref role=\"355D3t\" to=\"jh6v:1UvRDkPap5X\" resolve=\"SingleLanguageDependency\" />\n<ref role=\"355D3u\" to=\"jh6v:1UvRDkPap63\" resolve=\"version\" />\n</node>\n</node>\n<ref role=\"37wK5l\" to=\"xxte:25OQfQHQeFB\" resolve=\"getPropertyValue\" />\n<node concept=\"2OqwBi\" id=\"ON_jCgb8Ha\" role=\"37wK5m\">\n<node concept=\"355D3s\" id=\"ON_jCgb8Hb\" role=\"2Oq$k0\">\n- <ref role=\"355D3t\" to=\"jh6v:1UvRDkPap5X\" resolve=\"LanguageDependency\" />\n- <ref role=\"355D3u\" to=\"jh6v:1UvRDkPap5Y\" resolve=\"uuid\" />\n+ <ref role=\"355D3t\" to=\"jh6v:1UvRDkPap5X\" resolve=\"SingleLanguageDependency\" />\n+ <ref role=\"355D3u\" to=\"jh6v:7LiskgSqGCi\" resolve=\"uuid\" />\n</node>\n<node concept=\"liA8E\" id=\"ON_jCgb8Hc\" role=\"2OqNvi\">\n<ref role=\"37wK5l\" to=\"c17a:~SProperty.getName()\" resolve=\"getName\" />\n<ref role=\"37wK5l\" to=\"jks5:~INode.getPropertyValue(java.lang.String)\" resolve=\"getPropertyValue\" />\n<node concept=\"2OqwBi\" id=\"ON_jCgb8Hg\" role=\"37wK5m\">\n<node concept=\"355D3s\" id=\"ON_jCgb8Hh\" role=\"2Oq$k0\">\n- <ref role=\"355D3t\" to=\"jh6v:1UvRDkPap5X\" resolve=\"LanguageDependency\" />\n- <ref role=\"355D3u\" to=\"jh6v:1UvRDkPap5Y\" resolve=\"uuid\" />\n+ <ref role=\"355D3t\" to=\"jh6v:1UvRDkPap5X\" resolve=\"SingleLanguageDependency\" />\n+ <ref role=\"355D3u\" to=\"jh6v:7LiskgSqGCi\" resolve=\"uuid\" />\n</node>\n<node concept=\"liA8E\" id=\"ON_jCgb8Hi\" role=\"2OqNvi\">\n<ref role=\"37wK5l\" to=\"c17a:~SProperty.getName()\" resolve=\"getName\" />\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | resolve broken references after updating MPS extensions |
426,504 | 18.05.2022 11:20:54 | -7,200 | d9ed882512fb3f5684cd08e362bf1bc196508d51 | working on ModelSynchronizer_Test | [
{
"change_type": "MODIFY",
"old_path": "mps/org.modelix.model.mpsplugin/models/org.modelix.model.mpsplugin.mps",
"new_path": "mps/org.modelix.model.mpsplugin/models/org.modelix.model.mpsplugin.mps",
"diff": "<ref role=\"37wK5l\" to=\"qvpu:~PArea.executeRead(kotlin.jvm.functions.Function0)\" resolve=\"executeRead\" />\n<node concept=\"1bVj0M\" id=\"ON_jCgb8E$\" role=\"37wK5m\">\n<node concept=\"3clFbS\" id=\"ON_jCgb8E_\" role=\"1bW5cS\">\n+ <node concept=\"3cpWs8\" id=\"1C3$AqAWPvY\" role=\"3cqZAp\">\n+ <node concept=\"3cpWsn\" id=\"1C3$AqAWPvZ\" role=\"3cpWs9\">\n+ <property role=\"TrG5h\" value=\"module\" />\n+ <node concept=\"3uibUv\" id=\"1C3$AqAWPw0\" role=\"1tU5fm\">\n+ <ref role=\"3uigEE\" to=\"lui2:~SModule\" resolve=\"SModule\" />\n+ </node>\n+ <node concept=\"2OqwBi\" id=\"1C3$AqAWNMx\" role=\"33vP2m\">\n+ <node concept=\"37vLTw\" id=\"1C3$AqAWNMy\" role=\"2Oq$k0\">\n+ <ref role=\"3cqZAo\" node=\"4_k_9wJ_0gX\" resolve=\"model\" />\n+ </node>\n+ <node concept=\"liA8E\" id=\"1C3$AqAWNMz\" role=\"2OqNvi\">\n+ <ref role=\"37wK5l\" to=\"mhbf:~SModel.getModule()\" resolve=\"getModule\" />\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ <node concept=\"3clFbJ\" id=\"1C3$AqAWQIv\" role=\"3cqZAp\">\n+ <node concept=\"3clFbS\" id=\"1C3$AqAWQIx\" role=\"3clFbx\">\n+ <node concept=\"YS8fn\" id=\"1C3$AqAWShw\" role=\"3cqZAp\">\n+ <node concept=\"2ShNRf\" id=\"1C3$AqAWStI\" role=\"YScLw\">\n+ <node concept=\"1pGfFk\" id=\"1C3$AqAWUMc\" role=\"2ShVmc\">\n+ <ref role=\"37wK5l\" to=\"wyt6:~IllegalStateException.<init>(java.lang.String)\" resolve=\"IllegalStateException\" />\n+ <node concept=\"Xl_RD\" id=\"1C3$AqAWV77\" role=\"37wK5m\">\n+ <property role=\"Xl_RC\" value=\"The given model is not inserted in a module\" />\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ <node concept=\"3clFbC\" id=\"1C3$AqAWRBG\" role=\"3clFbw\">\n+ <node concept=\"10Nm6u\" id=\"1C3$AqAWRW1\" role=\"3uHU7w\" />\n+ <node concept=\"37vLTw\" id=\"1C3$AqAWRfq\" role=\"3uHU7B\">\n+ <ref role=\"3cqZAo\" node=\"1C3$AqAWPvZ\" resolve=\"module\" />\n+ </node>\n+ </node>\n+ </node>\n+ <node concept=\"3cpWs8\" id=\"1C3$AqAWNue\" role=\"3cqZAp\">\n+ <node concept=\"3cpWsn\" id=\"1C3$AqAWNuf\" role=\"3cpWs9\">\n+ <property role=\"TrG5h\" value=\"project\" />\n+ <node concept=\"3uibUv\" id=\"1C3$AqAWO32\" role=\"1tU5fm\">\n+ <ref role=\"3uigEE\" to=\"z1c3:~Project\" resolve=\"Project\" />\n+ </node>\n+ <node concept=\"2YIFZM\" id=\"1C3$AqAWNMw\" role=\"33vP2m\">\n+ <ref role=\"37wK5l\" to=\"z1c3:~SModuleOperations.getProjectForModule(org.jetbrains.mps.openapi.module.SModule)\" resolve=\"getProjectForModule\" />\n+ <ref role=\"1Pybhc\" to=\"z1c3:~SModuleOperations\" resolve=\"SModuleOperations\" />\n+ <node concept=\"37vLTw\" id=\"1C3$AqAWQ8C\" role=\"37wK5m\">\n+ <ref role=\"3cqZAo\" node=\"1C3$AqAWPvZ\" resolve=\"module\" />\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ <node concept=\"3clFbJ\" id=\"1C3$AqAWWvq\" role=\"3cqZAp\">\n+ <node concept=\"3clFbS\" id=\"1C3$AqAWWvr\" role=\"3clFbx\">\n+ <node concept=\"YS8fn\" id=\"1C3$AqAWWvs\" role=\"3cqZAp\">\n+ <node concept=\"2ShNRf\" id=\"1C3$AqAWWvt\" role=\"YScLw\">\n+ <node concept=\"1pGfFk\" id=\"1C3$AqAWWvu\" role=\"2ShVmc\">\n+ <ref role=\"37wK5l\" to=\"wyt6:~IllegalStateException.<init>(java.lang.String)\" resolve=\"IllegalStateException\" />\n+ <node concept=\"Xl_RD\" id=\"1C3$AqAWWvv\" role=\"37wK5m\">\n+ <property role=\"Xl_RC\" value=\"The module is not associated to a project\" />\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ <node concept=\"3clFbC\" id=\"1C3$AqAWWvw\" role=\"3clFbw\">\n+ <node concept=\"10Nm6u\" id=\"1C3$AqAWWvx\" role=\"3uHU7w\" />\n+ <node concept=\"37vLTw\" id=\"1C3$AqAWWWD\" role=\"3uHU7B\">\n+ <ref role=\"3cqZAo\" node=\"1C3$AqAWNuf\" resolve=\"project\" />\n+ </node>\n+ </node>\n+ </node>\n+ <node concept=\"3cpWs8\" id=\"1C3$AqAWYGK\" role=\"3cqZAp\">\n+ <node concept=\"3cpWsn\" id=\"1C3$AqAWYGL\" role=\"3cpWs9\">\n+ <property role=\"TrG5h\" value=\"repo\" />\n+ <node concept=\"3uibUv\" id=\"1C3$AqAWYGM\" role=\"1tU5fm\">\n+ <ref role=\"3uigEE\" to=\"lui2:~SRepository\" resolve=\"SRepository\" />\n+ </node>\n+ <node concept=\"2OqwBi\" id=\"1C3$AqAWZcn\" role=\"33vP2m\">\n+ <node concept=\"37vLTw\" id=\"1C3$AqAWZco\" role=\"2Oq$k0\">\n+ <ref role=\"3cqZAo\" node=\"1C3$AqAWNuf\" resolve=\"project\" />\n+ </node>\n+ <node concept=\"liA8E\" id=\"1C3$AqAWZcp\" role=\"2OqNvi\">\n+ <ref role=\"37wK5l\" to=\"z1c3:~Project.getRepository()\" resolve=\"getRepository\" />\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ <node concept=\"3clFbJ\" id=\"1C3$AqAX0oY\" role=\"3cqZAp\">\n+ <node concept=\"3clFbS\" id=\"1C3$AqAX0p0\" role=\"3clFbx\">\n+ <node concept=\"YS8fn\" id=\"1C3$AqAX1$q\" role=\"3cqZAp\">\n+ <node concept=\"2ShNRf\" id=\"1C3$AqAX1$r\" role=\"YScLw\">\n+ <node concept=\"1pGfFk\" id=\"1C3$AqAX1$s\" role=\"2ShVmc\">\n+ <ref role=\"37wK5l\" to=\"wyt6:~IllegalStateException.<init>(java.lang.String)\" resolve=\"IllegalStateException\" />\n+ <node concept=\"Xl_RD\" id=\"1C3$AqAX1$t\" role=\"37wK5m\">\n+ <property role=\"Xl_RC\" value=\"The project has no associated repository\" />\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ <node concept=\"3clFbC\" id=\"1C3$AqAX19H\" role=\"3clFbw\">\n+ <node concept=\"10Nm6u\" id=\"1C3$AqAX1lW\" role=\"3uHU7w\" />\n+ <node concept=\"37vLTw\" id=\"1C3$AqAX0CN\" role=\"3uHU7B\">\n+ <ref role=\"3cqZAo\" node=\"1C3$AqAWYGL\" resolve=\"repo\" />\n+ </node>\n+ </node>\n+ </node>\n<node concept=\"1QHqEM\" id=\"ON_jCgbamj\" role=\"3cqZAp\">\n<node concept=\"1QHqEC\" id=\"ON_jCgbaml\" role=\"1QHqEI\">\n<node concept=\"3clFbS\" id=\"ON_jCgbamn\" role=\"1bW5cS\">\n</node>\n</node>\n</node>\n- <node concept=\"2OqwBi\" id=\"ON_jCgbp9g\" role=\"ukAjM\">\n- <node concept=\"2YIFZM\" id=\"ON_jCgbnk7\" role=\"2Oq$k0\">\n- <ref role=\"37wK5l\" to=\"z1c3:~SModuleOperations.getProjectForModule(org.jetbrains.mps.openapi.module.SModule)\" resolve=\"getProjectForModule\" />\n- <ref role=\"1Pybhc\" to=\"z1c3:~SModuleOperations\" resolve=\"SModuleOperations\" />\n- <node concept=\"2OqwBi\" id=\"ON_jCgboGs\" role=\"37wK5m\">\n- <node concept=\"37vLTw\" id=\"ON_jCgboo6\" role=\"2Oq$k0\">\n- <ref role=\"3cqZAo\" node=\"4_k_9wJ_0gX\" resolve=\"model\" />\n- </node>\n- <node concept=\"liA8E\" id=\"ON_jCgboTW\" role=\"2OqNvi\">\n- <ref role=\"37wK5l\" to=\"mhbf:~SModel.getModule()\" resolve=\"getModule\" />\n- </node>\n- </node>\n- </node>\n- <node concept=\"liA8E\" id=\"ON_jCgbpMm\" role=\"2OqNvi\">\n- <ref role=\"37wK5l\" to=\"z1c3:~Project.getRepository()\" resolve=\"getRepository\" />\n- </node>\n+ <node concept=\"37vLTw\" id=\"1C3$AqAWZB$\" role=\"ukAjM\">\n+ <ref role=\"3cqZAo\" node=\"1C3$AqAWYGL\" resolve=\"repo\" />\n</node>\n</node>\n<node concept=\"3cpWs6\" id=\"ON_jCgb8Hv\" role=\"3cqZAp\">\n</node>\n</node>\n</node>\n- <node concept=\"3cqZAl\" id=\"4_k_9wJ_0gU\" role=\"3clF45\" />\n+ <node concept=\"3cqZAl\" id=\"1C3$AqAX3It\" role=\"3clF45\" />\n<node concept=\"37vLTG\" id=\"4_k_9wJ_0gV\" role=\"3clF46\">\n<property role=\"TrG5h\" value=\"tree\" />\n<node concept=\"3uibUv\" id=\"4_k_9wJ_0gW\" role=\"1tU5fm\">\n"
},
{
"change_type": "MODIFY",
"old_path": "mps/test.org.modelix.model.mpsplugin/models/[email protected]",
"new_path": "mps/test.org.modelix.model.mpsplugin/models/[email protected]",
"diff": "<import index=\"jks5\" ref=\"cc99dce1-49f3-4392-8dbf-e22ca47bd0af/java:org.modelix.model.api(org.modelix.model.api/)\" />\n<import index=\"qvpu\" ref=\"cc99dce1-49f3-4392-8dbf-e22ca47bd0af/java:org.modelix.model.area(org.modelix.model.api/)\" />\n<import index=\"jh6v\" ref=\"r:f2f39a18-fd23-4090-b7f2-ba8da340eec2(org.modelix.model.repositoryconcepts.structure)\" />\n+ <import index=\"lui2\" ref=\"8865b7a8-5271-43d3-884c-6fd1d9cfdd34/java:org.jetbrains.mps.openapi.module(MPS.OpenAPI/)\" />\n+ <import index=\"g3l6\" ref=\"6ed54515-acc8-4d1e-a16c-9fd6cfe951ea/java:jetbrains.mps.extapi.model(MPS.Core/)\" implicit=\"true\" />\n</imports>\n<registry>\n<language id=\"a247e09e-2435-45ba-b8d2-07e93feba96a\" name=\"jetbrains.mps.baseLanguage.tuples\">\n<concept id=\"1081236700937\" name=\"jetbrains.mps.baseLanguage.structure.StaticMethodCall\" flags=\"nn\" index=\"2YIFZM\">\n<reference id=\"1144433194310\" name=\"classConcept\" index=\"1Pybhc\" />\n</concept>\n+ <concept id=\"1164991038168\" name=\"jetbrains.mps.baseLanguage.structure.ThrowStatement\" flags=\"nn\" index=\"YS8fn\">\n+ <child id=\"1164991057263\" name=\"throwable\" index=\"YScLw\" />\n+ </concept>\n<concept id=\"1070533707846\" name=\"jetbrains.mps.baseLanguage.structure.StaticFieldReference\" flags=\"nn\" index=\"10M0yZ\">\n<reference id=\"1144433057691\" name=\"classifier\" index=\"1PxDUh\" />\n</concept>\n</node>\n</node>\n</node>\n- <node concept=\"3cpWs8\" id=\"7zuOo8p4r8L\" role=\"3cqZAp\">\n- <node concept=\"3cpWsn\" id=\"7zuOo8p4r8M\" role=\"3cpWs9\">\n- <property role=\"TrG5h\" value=\"webModel\" />\n- <node concept=\"3uibUv\" id=\"7zuOo8p4pWG\" role=\"1tU5fm\">\n- <ref role=\"3uigEE\" to=\"csg2:4QZGLsLEOdM\" resolve=\"CloudTransientModel\" />\n+ <node concept=\"3cpWs8\" id=\"1C3$AqAZmlm\" role=\"3cqZAp\">\n+ <node concept=\"3cpWsn\" id=\"1C3$AqAZmln\" role=\"3cpWs9\">\n+ <property role=\"TrG5h\" value=\"webModule\" />\n+ <node concept=\"3uibUv\" id=\"1C3$AqAZLr5\" role=\"1tU5fm\">\n+ <ref role=\"3uigEE\" to=\"csg2:115Xaa43tZI\" resolve=\"CloudTransientModule\" />\n</node>\n- <node concept=\"2ShNRf\" id=\"7zuOo8p4r8N\" role=\"33vP2m\">\n- <node concept=\"1pGfFk\" id=\"7zuOo8p4r8O\" role=\"2ShVmc\">\n- <ref role=\"37wK5l\" to=\"csg2:4QZGLsLEOdX\" resolve=\"CloudTransientModel\" />\n- <node concept=\"2ShNRf\" id=\"7zuOo8p4r8P\" role=\"37wK5m\">\n+ <node concept=\"2ShNRf\" id=\"7zuOo8p4r8P\" role=\"33vP2m\">\n<node concept=\"1pGfFk\" id=\"7zuOo8p4r8Q\" role=\"2ShVmc\">\n<ref role=\"37wK5l\" to=\"csg2:115Xaa43tZP\" resolve=\"CloudTransientModule\" />\n<node concept=\"Xl_RD\" id=\"7zuOo8p4r8R\" role=\"37wK5m\">\n<property role=\"Xl_RC\" value=\"testModule\" />\n</node>\n<node concept=\"2YIFZM\" id=\"4rrX99ogfg5\" role=\"37wK5m\">\n- <ref role=\"37wK5l\" to=\"z1c3:~ModuleId.regular()\" resolve=\"regular\" />\n<ref role=\"1Pybhc\" to=\"z1c3:~ModuleId\" resolve=\"ModuleId\" />\n+ <ref role=\"37wK5l\" to=\"z1c3:~ModuleId.regular()\" resolve=\"regular\" />\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n</node>\n+ <node concept=\"3cpWs8\" id=\"7zuOo8p4r8L\" role=\"3cqZAp\">\n+ <node concept=\"3cpWsn\" id=\"7zuOo8p4r8M\" role=\"3cpWs9\">\n+ <property role=\"TrG5h\" value=\"webModel\" />\n+ <node concept=\"3uibUv\" id=\"7zuOo8p4pWG\" role=\"1tU5fm\">\n+ <ref role=\"3uigEE\" to=\"csg2:4QZGLsLEOdM\" resolve=\"CloudTransientModel\" />\n</node>\n+ <node concept=\"2ShNRf\" id=\"7zuOo8p4r8N\" role=\"33vP2m\">\n+ <node concept=\"1pGfFk\" id=\"7zuOo8p4r8O\" role=\"2ShVmc\">\n+ <ref role=\"37wK5l\" to=\"csg2:4QZGLsLEOdX\" resolve=\"CloudTransientModel\" />\n+ <node concept=\"37vLTw\" id=\"1C3$AqAZDHI\" role=\"37wK5m\">\n+ <ref role=\"3cqZAo\" node=\"1C3$AqAZmln\" resolve=\"webModule\" />\n</node>\n<node concept=\"Xl_RD\" id=\"7zuOo8p4r8S\" role=\"37wK5m\">\n<property role=\"Xl_RC\" value=\"testModule\" />\n</node>\n</node>\n</node>\n+ <node concept=\"3clFbF\" id=\"1C3$AqB0vxX\" role=\"3cqZAp\">\n+ <node concept=\"2OqwBi\" id=\"1C3$AqB0$0h\" role=\"3clFbG\">\n+ <node concept=\"37vLTw\" id=\"1C3$AqB0vxV\" role=\"2Oq$k0\">\n+ <ref role=\"3cqZAo\" node=\"7zuOo8p4r8M\" resolve=\"webModel\" />\n+ </node>\n+ <node concept=\"liA8E\" id=\"1C3$AqB0CQK\" role=\"2OqNvi\">\n+ <ref role=\"37wK5l\" to=\"g3l6:~SModelBase.setModule(org.jetbrains.mps.openapi.module.SModule)\" resolve=\"setModule\" />\n+ <node concept=\"37vLTw\" id=\"1C3$AqB0CTn\" role=\"37wK5m\">\n+ <ref role=\"3cqZAo\" node=\"1C3$AqAZmln\" resolve=\"webModule\" />\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ <node concept=\"3clFbJ\" id=\"1C3$AqAYUJY\" role=\"3cqZAp\">\n+ <node concept=\"3clFbS\" id=\"1C3$AqAYUK0\" role=\"3clFbx\">\n+ <node concept=\"YS8fn\" id=\"1C3$AqAZd0r\" role=\"3cqZAp\">\n+ <node concept=\"2ShNRf\" id=\"1C3$AqAZd12\" role=\"YScLw\">\n+ <node concept=\"1pGfFk\" id=\"1C3$AqAZPLd\" role=\"2ShVmc\">\n+ <ref role=\"37wK5l\" to=\"wyt6:~IllegalStateException.<init>(java.lang.String)\" resolve=\"IllegalStateException\" />\n+ <node concept=\"Xl_RD\" id=\"1C3$AqAZPRn\" role=\"37wK5m\">\n+ <property role=\"Xl_RC\" value=\"The webModel should be inserted in the webModule\" />\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ <node concept=\"3clFbC\" id=\"1C3$AqAZ8By\" role=\"3clFbw\">\n+ <node concept=\"10Nm6u\" id=\"1C3$AqAZc6j\" role=\"3uHU7w\" />\n+ <node concept=\"2OqwBi\" id=\"1C3$AqAZ3t3\" role=\"3uHU7B\">\n+ <node concept=\"37vLTw\" id=\"1C3$AqAYYKs\" role=\"2Oq$k0\">\n+ <ref role=\"3cqZAo\" node=\"7zuOo8p4r8M\" resolve=\"webModel\" />\n+ </node>\n+ <node concept=\"liA8E\" id=\"1C3$AqAZ8uV\" role=\"2OqNvi\">\n+ <ref role=\"37wK5l\" to=\"g3l6:~SModelBase.getModule()\" resolve=\"getModule\" />\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n<node concept=\"3cpWs8\" id=\"6hBdEE_hRA_\" role=\"3cqZAp\">\n<node concept=\"3cpWsn\" id=\"6hBdEE_hRAA\" role=\"3cpWs9\">\n<property role=\"TrG5h\" value=\"binding\" />\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | working on ModelSynchronizer_Test |
426,496 | 18.05.2022 17:44:42 | -7,200 | 345be6fb431d9107966e960dd6ffa866efb0dadc | Use generation and compile dependencies when selecting modules for deployment | [
{
"change_type": "MODIFY",
"old_path": "workspace-manager/build.gradle.kts",
"new_path": "workspace-manager/build.gradle.kts",
"diff": "@@ -38,7 +38,7 @@ dependencies {\nimplementation(project(\":headless-mps\"))\nimplementation(project(\":workspaces\"))\nimplementation(project(\":gitui\"))\n- implementation(\"org.modelix.mpsbuild:build-tools:1.0.3\")\n+ implementation(\"org.modelix.mpsbuild:build-tools:1.0.5\")\nimplementation(\"io.ktor\",\"ktor-html-builder\", ktorVersion)\ntestImplementation(\"org.junit.jupiter:junit-jupiter-api:5.6.0\")\ntestRuntimeOnly(\"org.junit.jupiter:junit-jupiter-engine\")\n"
},
{
"change_type": "MODIFY",
"old_path": "workspace-manager/src/main/kotlin/org/modelix/workspace/manager/WorkspaceManager.kt",
"new_path": "workspace-manager/src/main/kotlin/org/modelix/workspace/manager/WorkspaceManager.kt",
"diff": "@@ -181,7 +181,7 @@ class WorkspaceManager {\nif (workspace.loadUsedModulesOnly) {\n// to reduce the required memory include only those modules in the zip that are actually used\nval resolver = ModuleResolver(modulesMiner.getModules(), workspace.ignoredModules.map { ModuleId(it) }.toSet(), true)\n- val graph = PublicationDependencyGraph(resolver)\n+ val graph = PublicationDependencyGraph(resolver, workspace.additionalGenerationDependenciesAsMap())\ngraph.load(modulesMiner.getModules().getModules().values)\nval sourceModules: Set<ModuleId> = modulesMiner.getModules().getModules()\n.filter { it.value.owner is SourceModuleOwner }.keys -\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Use generation and compile dependencies when selecting modules for deployment |
426,496 | 18.05.2022 19:17:27 | -7,200 | 4537b872af2532fa401fbed86026f03c83cee411 | To many files were removed after the dependency analysis | [
{
"change_type": "MODIFY",
"old_path": "workspace-manager/src/main/kotlin/org/modelix/workspace/manager/WorkspaceManager.kt",
"new_path": "workspace-manager/src/main/kotlin/org/modelix/workspace/manager/WorkspaceManager.kt",
"diff": "@@ -192,7 +192,13 @@ class WorkspaceManager {\ntransitiveDependencies += it\n}\nval usedModuleOwners = transitiveDependencies.flatMap { it.modules }.map { it.owner }.toSet()\n- val includedFolders = usedModuleOwners.map { it.path.getLocalAbsolutePath() }.toSet()\n+ val includedFolders: Set<Path> = usedModuleOwners.map { it.getRootOwner() }.distinct().flatMap {\n+ when (it) {\n+ is SourceModuleOwner -> listOf(it.path.getLocalAbsolutePath().parent)\n+ is LibraryModuleOwner -> (it.getGeneratorJars() + it.getPrimaryJar() + listOfNotNull(it.getSourceJar())).map { it.toPath() }\n+ else -> listOf(it.path.getLocalAbsolutePath())\n+ }\n+ }.toSet()\n//job.outputHandler(\"Included Folders: \")\n//includedFolders.sorted().forEach { job.outputHandler(\" $it\") }\nval usedModulesOnly: (Path) -> Boolean = { path -> path.ancestorsAndSelf().any { includedFolders.contains(it) } }\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | To many files were removed after the dependency analysis |
426,496 | 19.05.2022 09:56:45 | -7,200 | baacf40dcea409fb7c4206b934262839798991df | Respect plugin dependencies when filtering modules for deployment | [
{
"change_type": "MODIFY",
"old_path": "workspace-manager/src/main/kotlin/org/modelix/workspace/manager/WorkspaceManager.kt",
"new_path": "workspace-manager/src/main/kotlin/org/modelix/workspace/manager/WorkspaceManager.kt",
"diff": "@@ -191,8 +191,14 @@ class WorkspaceManager {\nit.getTransitiveDependencies(transitiveDependencies)\ntransitiveDependencies += it\n}\n- val usedModuleOwners = transitiveDependencies.flatMap { it.modules }.map { it.owner }.toSet()\n- val includedFolders: Set<Path> = usedModuleOwners.map { it.getRootOwner() }.distinct().flatMap {\n+ var usedModuleOwners = transitiveDependencies.flatMap { it.modules }.map { it.owner }.toSet()\n+ usedModuleOwners = usedModuleOwners.map { it.getRootOwner() }.toSet()\n+ val transitivePlugins = kotlin.collections.HashMap<String, PluginModuleOwner>()\n+ usedModuleOwners.filterIsInstance<PluginModuleOwner>().forEach {\n+ modulesMiner.getModules().getPluginWithDependencies(it.pluginId, transitivePlugins)\n+ }\n+ usedModuleOwners += transitivePlugins.map { it.value }\n+ val includedFolders: Set<Path> = usedModuleOwners.flatMap {\nwhen (it) {\nis SourceModuleOwner -> listOf(it.path.getLocalAbsolutePath().parent)\nis LibraryModuleOwner -> (it.getGeneratorJars() + it.getPrimaryJar() + listOfNotNull(it.getSourceJar())).map { it.toPath() }\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Respect plugin dependencies when filtering modules for deployment |
426,496 | 19.05.2022 17:44:54 | -7,200 | 69bba4a5721e2b1fee9dbbb11d68167b08018ccc | Improved handling of workspace configuration changes | [
{
"change_type": "MODIFY",
"old_path": "instances-manager/src/main/kotlin/org/modelix/instancesmanager/AdminModule.kt",
"new_path": "instances-manager/src/main/kotlin/org/modelix/instancesmanager/AdminModule.kt",
"diff": "@@ -75,6 +75,7 @@ fun Application.adminModule() {\nval assignmentCells: TR.() -> Unit = {\ntd {\nrowSpan = assignment.instances.size.coerceAtLeast(1).toString()\n+ if (!assignment.isLatest) style = \"color: #aaa\"\n+(assignment.workspace.name ?: \"<no name>\")\nbr{}\n+assignment.workspace.id\n"
},
{
"change_type": "MODIFY",
"old_path": "instances-manager/src/main/kotlin/org/modelix/instancesmanager/AssignmentData.kt",
"new_path": "instances-manager/src/main/kotlin/org/modelix/instancesmanager/AssignmentData.kt",
"diff": "@@ -15,5 +15,5 @@ package org.modelix.instancesmanager\nimport org.modelix.workspaces.Workspace\n-class AssignmentData(val workspace: Workspace, val unassignedInstances: Int, val instances: List<InstanceStatus>) {\n+class AssignmentData(val workspace: Workspace, val unassignedInstances: Int, val instances: List<InstanceStatus>, val isLatest: Boolean) {\n}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "instances-manager/src/main/kotlin/org/modelix/instancesmanager/DeploymentManager.kt",
"new_path": "instances-manager/src/main/kotlin/org/modelix/instancesmanager/DeploymentManager.kt",
"diff": "@@ -40,6 +40,7 @@ class DeploymentManager {\noverride fun run() {\nwhile (true) {\ntry {\n+ createAssignmentsForAllWorkspaces()\nreconcileDeployments()\n} catch (ex: Exception) {\nLOG.error(\"\", ex)\n@@ -63,7 +64,10 @@ class DeploymentManager {\n}\nfun getAssignments(): List<AssignmentData> {\n- var hash2workspace = workspacePersistence.getWorkspaceIds().mapNotNull { workspacePersistence.getWorkspaceForId(it) }.associate { it.second to it.first }\n+ val latestWorkspaces =\n+ workspacePersistence.getWorkspaceIds().mapNotNull { workspacePersistence.getWorkspaceForId(it) }\n+ val latestWorkspaceHashes = latestWorkspaces.map { it.second }.toSet()\n+ var hash2workspace = latestWorkspaces.associate { it.second to it.first }\nvar assignmentsCopy: HashMap<WorkspaceHash, Assignments>\nsynchronized(assignments) {\n@@ -80,7 +84,8 @@ class DeploymentManager {\nunassignedInstances = assignment?.getNumberOfUnassigned() ?: 0,\n(assignment?.listDeployments() ?: emptyList()).map { deployment ->\nInstanceStatus(workspace, deployment.first, deployment.second, disabledInstances.contains(deployment.second))\n- }\n+ },\n+ isLatest = latestWorkspaceHashes.contains(it.key)\n)\n}\n}\n@@ -106,7 +111,7 @@ class DeploymentManager {\n}\nfun changeNumberOfAssigned(workspaceHash: WorkspaceHash, newNumber: Int) {\n- getAssignments(workspacePersistence.getWorkspaceForHash(workspaceHash)!!).setNumberOfUnassigned(newNumber)\n+ getAssignments(workspacePersistence.getWorkspaceForHash(workspaceHash)!!).setNumberOfUnassigned(newNumber, true)\n}\nfun isInstanceDisabled(instanceId: String): Boolean = disabledInstances.contains(instanceId)\n@@ -151,6 +156,26 @@ class DeploymentManager {\ncleanupThread.start()\n}\n+ private fun createAssignmentsForAllWorkspaces() {\n+ val latestVersions = workspacePersistence.getWorkspaceIds()\n+ .mapNotNull { workspacePersistence.getWorkspaceForId(it) }.associateBy { it.first.id }\n+ val allExistingVersions = assignments.entries.groupBy { it.value.workspace.id }\n+\n+ for (latestVersion in latestVersions) {\n+ val existingVersions: List<MutableMap.MutableEntry<WorkspaceHash, Assignments>>? = allExistingVersions[latestVersion.key]\n+ if (existingVersions != null && existingVersions.any { it.key == latestVersion.value.second }) continue\n+ val assignment = getAssignments(latestVersion.value.first)\n+ val unassigned = existingVersions?.maxOfOrNull { it.value.getNumberOfUnassigned() } ?: 0\n+ assignment.setNumberOfUnassigned(unassigned, false)\n+ existingVersions?.forEach { it.value.resetNumberOfUnassigned() }\n+ }\n+\n+ val deletedIds = allExistingVersions.keys - latestVersions.keys\n+ for (deleted in deletedIds.flatMap { allExistingVersions[it]!! }) {\n+ deleted.value.resetNumberOfUnassigned()\n+ }\n+ }\n+\nprivate fun reconcileDeployments() {\n// TODO doesn't work with multiple instances of this proxy\nsynchronized(reconcileLock) {\n@@ -337,7 +362,8 @@ class DeploymentManager {\nprivate inner class Assignments(val workspace: Workspace) {\nprivate val userId2deployment: MutableMap<String, String> = HashMap()\nprivate val unassignedDeployments: MutableList<String> = LinkedList()\n- private var numberOfUnassigned: Int = 1\n+ private var numberOfUnassignedAuto: Int? = null\n+ private var numberOfUnassignedSetByUser: Int? = null\nfun listDeployments(): List<Pair<String?, String>> {\nreturn userId2deployment.map { it.key to it.value } + unassignedDeployments.map { null to it }\n@@ -361,20 +387,31 @@ class DeploymentManager {\n}\n@Synchronized\n- fun setNumberOfUnassigned(targetNumber: Int) {\n- numberOfUnassigned = targetNumber\n+ fun setNumberOfUnassigned(targetNumber: Int, setByUser: Boolean) {\n+ if (setByUser) {\n+ numberOfUnassignedSetByUser = targetNumber\n+ } else {\n+ numberOfUnassignedAuto = targetNumber\n+ }\n+ reconcile()\n+ }\n+\n+ @Synchronized\n+ fun resetNumberOfUnassigned() {\n+ numberOfUnassignedSetByUser = null\n+ numberOfUnassignedAuto = null\nreconcile()\n}\n- fun getNumberOfUnassigned() = numberOfUnassigned\n+ fun getNumberOfUnassigned() = numberOfUnassignedSetByUser ?: numberOfUnassignedAuto ?: 0\n@Synchronized\nfun reconcile() {\n- while (unassignedDeployments.size > numberOfUnassigned) {\n+ while (unassignedDeployments.size > getNumberOfUnassigned()) {\nunassignedDeployments.removeAt(unassignedDeployments.size - 1)\ndirty.set(true)\n}\n- while (unassignedDeployments.size < numberOfUnassigned) {\n+ while (unassignedDeployments.size < getNumberOfUnassigned()) {\nunassignedDeployments.add(generatePersonalDeploymentName(workspace))\ndirty.set(true)\n}\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Improved handling of workspace configuration changes |
426,496 | 20.05.2022 09:16:21 | -7,200 | 09499a2e12b20c65d789ec5801e07bd735fb5cc9 | Number of unassigned instances can be changed with a single button click
There was a number input and a button before. Now there are just
6 buttons for the values 0..5. | [
{
"change_type": "MODIFY",
"old_path": "instances-manager/src/main/kotlin/org/modelix/instancesmanager/AdminModule.kt",
"new_path": "instances-manager/src/main/kotlin/org/modelix/instancesmanager/AdminModule.kt",
"diff": "@@ -89,12 +89,12 @@ fun Application.adminModule() {\nname = \"workspaceHash\"\nvalue = assignment.workspace.hash().hash\n}\n- numberInput {\n+ for (newValue in 0..5) {\n+ submitInput {\n+ disabled = newValue == assignment.unassignedInstances\nname = \"numberOfUnassigned\"\n- value = assignment.unassignedInstances.toString()\n+ value = \"$newValue\"\n}\n- submitInput {\n- value = \"Apply\"\n}\n}\n}\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Number of unassigned instances can be changed with a single button click
There was a number input and a button before. Now there are just
6 buttons for the values 0..5. |
426,496 | 20.05.2022 14:07:10 | -7,200 | cc8fefc1692fa4ef4c5165f9a3b51a87b8059920 | Progress bar instead of console output while waiting for MPS startup | [
{
"change_type": "MODIFY",
"old_path": "instances-manager/src/main/kotlin/org/modelix/instancesmanager/DeploymentManager.kt",
"new_path": "instances-manager/src/main/kotlin/org/modelix/instancesmanager/DeploymentManager.kt",
"diff": "@@ -245,12 +245,27 @@ class DeploymentManager {\nreturn deployment\n}\n- fun getPodLogs(deploymentName: String?): String? {\n+ fun getPod(deploymentName: String): V1Pod? {\ntry {\nval coreApi = CoreV1Api()\nval pods = coreApi.listNamespacedPod(KUBERNETES_NAMESPACE, null, null, null, null, null, null, null, null, null)\nfor (pod in pods.items) {\n- if (!pod.metadata!!.name!!.startsWith(deploymentName!!)) continue\n+ if (!pod.metadata!!.name!!.startsWith(deploymentName)) continue\n+ return pod\n+ }\n+ } catch (e: Exception) {\n+ LOG.error(\"\", e)\n+ return null\n+ }\n+ return null\n+ }\n+\n+ fun getPodLogs(deploymentName: String): String? {\n+ try {\n+ val coreApi = CoreV1Api()\n+ val pods = coreApi.listNamespacedPod(KUBERNETES_NAMESPACE, null, null, null, null, null, null, null, null, null)\n+ for (pod in pods.items) {\n+ if (!pod.metadata!!.name!!.startsWith(deploymentName)) continue\nreturn coreApi.readNamespacedPodLog(\npod.metadata!!.name,\nKUBERNETES_NAMESPACE,\n@@ -280,6 +295,12 @@ class DeploymentManager {\nreturn workspacePersistence.getWorkspaceForHash(WorkspaceHash(workspaceHash))\n}\n+ @Synchronized\n+ fun getWorkspaceForInstance(instanceId: String): Workspace? {\n+ return assignments.values.filter { it.getAllDeploymentNames().any { it == instanceId } }\n+ .map { it.workspace }.firstOrNull()\n+ }\n+\n@Throws(IOException::class, ApiException::class)\nfun createDeployment(workspace: Workspace, personalDeploymentName: String?): Boolean {\nval originalDeploymentName = WORKSPACE_CLIENT_DEPLOYMENT_NAME\n"
},
{
"change_type": "MODIFY",
"old_path": "instances-manager/src/main/kotlin/org/modelix/instancesmanager/DeploymentManagingHandler.kt",
"new_path": "instances-manager/src/main/kotlin/org/modelix/instancesmanager/DeploymentManagingHandler.kt",
"diff": "@@ -27,8 +27,7 @@ import javax.servlet.http.HttpServletResponse\nclass DeploymentManagingHandler : AbstractHandler() {\noverride fun handle(target: String, baseRequest: Request, request: HttpServletRequest, response: HttpServletResponse) {\ntry {\n- val deploymentManager: DeploymentManager = DeploymentManager.Companion.INSTANCE\n- val redirectedURL = deploymentManager.redirect(baseRequest, request) ?: return\n+ val redirectedURL = DeploymentManager.INSTANCE.redirect(baseRequest, request) ?: return\nval personalDeploymentName = redirectedURL.personalDeploymentName ?: return\nif (DeploymentManager.INSTANCE.isInstanceDisabled(personalDeploymentName)) {\n@@ -40,67 +39,44 @@ class DeploymentManagingHandler : AbstractHandler() {\n}\nDeploymentTimeouts.INSTANCE.update(personalDeploymentName)\n- val deployment = deploymentManager.getDeployment(personalDeploymentName, 3)\n+ val deployment = DeploymentManager.INSTANCE.getDeployment(personalDeploymentName, 3)\n?: throw RuntimeException(\"Failed to create deployment \" + personalDeploymentName + \" for user \" + redirectedURL.userId)\nval readyReplicas = if (deployment.status != null) deployment.status!!.readyReplicas else null\nif (readyReplicas == null || readyReplicas == 0) {\nbaseRequest.isHandled = true\nresponse.contentType = \"text/html\"\nresponse.status = HttpServletResponse.SC_OK\n- val podLogs = deploymentManager.getPodLogs(personalDeploymentName)\n- val events = deploymentManager.getEvents(personalDeploymentName)\n- val eventTime: (V1Event)-> DateTime? = {\n- listOfNotNull(\n- it.eventTime,\n- it.lastTimestamp,\n- it.firstTimestamp\n- ).firstOrNull()\n- }\n- response.writer.append(\"\"\"\n- <html>\n- <head>\n- <meta http-equiv=\"refresh\" content=\"5\">\n- <style>\n- table {\n- border-collapse: collapse;\n- }\n- td {\n- border: 1px solid #aaa;\n- padding: 0px 6px;\n- }\n- </style>\n- </head>\n- <body>\n- <div>Starting MPS ... (<a href=\"/instances-manager/\" target=\"_blank\">Manage Instances</a>)</div>\n- \"\"\".trimIndent())\n- if (events.isNotEmpty()) {\n- response.writer.append(\"<br/><hr/><br/><table>\")\n- for (event in events.sortedBy(eventTime)) {\n- response.writer.append(\"<tr>\")\n- response.writer.append(\"<td>\")\n- StringEscapeUtils.escapeHtml(response.writer, eventTime(event)?.toLocalTime()?.toString(\"HH:mm:ss\") ?: \"---\")\n- response.writer.append(\"</td>\")\n- response.writer.append(\"<td>\")\n- StringEscapeUtils.escapeHtml(response.writer, event.type)\n- response.writer.append(\"</td>\")\n- response.writer.append(\"<td>\")\n- StringEscapeUtils.escapeHtml(response.writer, event.reason)\n- response.writer.append(\"</td>\")\n- response.writer.append(\"<td>\")\n- StringEscapeUtils.escapeHtml(response.writer, event.message)\n- response.writer.append(\"</td>\")\n- response.writer.append(\"</tr>\")\n- }\n- response.writer.append(\"</table>\")\n+ var html = this.javaClass.getResource(\"/static/status-screen.html\")?.readText() ?: \"\"\n+ val workspace = DeploymentManager.INSTANCE.getWorkspaceForInstance(personalDeploymentName)\n+\n+ var progress: Int = 10\n+ if (DeploymentManager.INSTANCE.getPod(personalDeploymentName)?.status?.phase == \"Running\") {\n+ val log = DeploymentManager.INSTANCE.getPodLogs(personalDeploymentName) ?: \"\"\n+ val string2progress: List<Pair<String, Int>> = listOf(\n+ \"env: \" to 25,\n+ \"Installed plugin from\" to 30,\n+ \"./ide-projector-launcher.sh\" to 35,\n+ \"Found IDE: mps\" to 40,\n+ \"Listening for transport dt_socket at address\" to 45,\n+ \"[DEBUG] :: IdeState :: \\\"Init ProjectorClassLoader\\\" is done\" to 50,\n+ \"[DEBUG] :: IdeState :: \\\"run transformations\\\" is done\" to 55,\n+ \"[DEBUG] :: ProjectorBatchTransformer :: Success\" to 60,\n+ \"execution mode: PROJECTOR\" to 70,\n+ \"ModelServerConnection - connected to\" to 75,\n+ \"AutoBindings - trying to bind project:\" to 80,\n+ \"AutoBindings - adding project binding\" to 90,\n+ )\n+ progress = string2progress.lastOrNull { log.contains(it.first) }?.second ?: 20\n}\n- if (podLogs != null) {\n- response.writer.append(\"<br/><hr/><br/><pre>\")\n- StringEscapeUtils.escapeHtml(response.writer, podLogs)\n- response.writer.append(\"</pre>\")\n+\n+ if (workspace != null) {\n+ html = html.replace(\"{{workspaceName}}\", workspace.name ?: workspace.id)\n+ } else {\n+ progress = 0\n}\n- response.writer\n- .append(\"</body>\")\n- .append(\"</html>\")\n+ html = html.replace(\"{{progressPercent}}\", progress.toString())\n+ html = html.replace(\"{{instanceId}}\", personalDeploymentName)\n+ response.writer.append(html)\n}\n} catch (ex: Exception) {\nthrow RuntimeException(ex)\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "instances-manager/src/main/resources/static/status-screen.html",
"diff": "+<!DOCTYPE html>\n+<html lang=\"en\">\n+<head>\n+ <meta charset=\"UTF-8\">\n+ <title>Loading {{workspaceName}}</title>\n+ <meta http-equiv=\"refresh\" content=\"1\"/>\n+ <style>\n+ body {\n+ font-family: \"Montserrat\", sans-serif;\n+ background: black;\n+ color: white;\n+ }\n+\n+ .container {\n+ margin: 220px auto 100px;\n+ width: 400px;\n+ text-align: center;\n+ position: relative;\n+ color: #f3c623;\n+ }\n+\n+ .progress {\n+ border-radius: 30px;\n+ background-color: #fff;\n+ }\n+\n+ .progress-bar {\n+ height: 18px;\n+ border-radius: 30px;\n+ background-color: #f3c623;\n+ width: 50%;\n+ box-shadow: 0 0 15px #f3c623;\n+ }\n+\n+ .status-text {\n+ margin-bottom: 15px;\n+ }\n+\n+ #detailed-status {\n+ margin-top: 50px;\n+ }\n+\n+ #detailed-status a {\n+ color: #888;\n+ }\n+ </style>\n+</head>\n+<body>\n+ <div class=\"container\">\n+ <div class=\"status-text\">Loading Workspace {{workspaceName}} ...</div>\n+ <div class=\"progress\">\n+ <div class=\"progress-bar\" style=\"width: {{progressPercent}}%\"></div>\n+ </div>\n+ <div id=\"detailed-status\"><a href=\"/instances-manager/log/{{instanceId}}/\" target=\"_blank\">Detailed Status</a></div>\n+ </div>\n+</body>\n+</html>\n\\ No newline at end of file\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Progress bar instead of console output while waiting for MPS startup |
426,496 | 20.05.2022 14:10:55 | -7,200 | 5b20981622122b4b1b9be13fe7fba3242a548b91 | Use JGIT 6.1.0.202203080745-r | [
{
"change_type": "MODIFY",
"old_path": "instances-manager/build.gradle",
"new_path": "instances-manager/build.gradle",
"diff": "@@ -41,7 +41,7 @@ dependencies {\ncompile group: 'org.eclipse.jetty.websocket', name: 'websocket-client', version: jettyVersion\ncompile group: 'org.eclipse.jetty.websocket', name: 'websocket-server', version: jettyVersion\n- compile group: 'org.eclipse.jgit', name: 'org.eclipse.jgit', version: '5.8.0.202006091008-r'\n+ compile group: 'org.eclipse.jgit', name: 'org.eclipse.jgit', version: '6.1.0.202203080745-r'\ncompile group: 'org.kohsuke', name: 'github-api', version: '1.115'\nimplementation(project(path: \":model-client\", configuration: \"jvmRuntimeElements\"))\n"
},
{
"change_type": "MODIFY",
"old_path": "ui-proxy/build.gradle",
"new_path": "ui-proxy/build.gradle",
"diff": "@@ -34,7 +34,7 @@ dependencies {\ncompile group: 'org.eclipse.jetty.websocket', name: 'websocket-client', version: jettyVersion\ncompile group: 'org.eclipse.jetty.websocket', name: 'websocket-server', version: jettyVersion\n- compile group: 'org.eclipse.jgit', name: 'org.eclipse.jgit', version: '5.8.0.202006091008-r'\n+ compile group: 'org.eclipse.jgit', name: 'org.eclipse.jgit', version: '6.1.0.202203080745-r'\ncompile group: 'org.kohsuke', name: 'github-api', version: '1.115'\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "ui-server/build.gradle",
"new_path": "ui-server/build.gradle",
"diff": "@@ -15,7 +15,7 @@ compileJava {\ndependencies {\ncompileOnly fileTree(dir: '../artifacts/mps/lib', include: '*.jar')\n- compile group: 'org.eclipse.jgit', name: 'org.eclipse.jgit', version: '5.8.0.202006091008-r'\n+ compile group: 'org.eclipse.jgit', name: 'org.eclipse.jgit', version: '6.1.0.202203080745-r'\ncompile group: 'commons-io', name: 'commons-io', version: '2.7'\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "workspace-client/build.gradle.kts",
"new_path": "workspace-client/build.gradle.kts",
"diff": "@@ -32,7 +32,7 @@ dependencies {\nimplementation(\"org.jetbrains.kotlinx\", \"kotlinx-coroutines-jdk8\", kotlinCoroutinesVersion)\nimplementation(\"org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2\")\nimplementation(\"com.charleskorn.kaml:kaml:0.40.0\")\n- implementation(\"org.eclipse.jgit:org.eclipse.jgit:5.8.0.202006091008-r\")\n+ implementation(\"org.eclipse.jgit:org.eclipse.jgit:6.1.0.202203080745-r\")\nimplementation(\"org.apache.maven.shared:maven-invoker:3.1.0\")\nimplementation(\"org.zeroturnaround:zt-zip:1.14\")\nimplementation(\"org.apache.commons:commons-text:1.9\")\n"
},
{
"change_type": "MODIFY",
"old_path": "workspace-manager/build.gradle.kts",
"new_path": "workspace-manager/build.gradle.kts",
"diff": "@@ -29,7 +29,7 @@ dependencies {\nimplementation(\"org.jetbrains.kotlinx\", \"kotlinx-coroutines-jdk8\", kotlinCoroutinesVersion)\nimplementation(\"org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2\")\nimplementation(\"com.charleskorn.kaml:kaml:0.40.0\")\n- implementation(\"org.eclipse.jgit:org.eclipse.jgit:5.8.0.202006091008-r\")\n+ implementation(\"org.eclipse.jgit:org.eclipse.jgit:6.1.0.202203080745-r\")\nimplementation(\"org.apache.maven.shared:maven-invoker:3.1.0\")\nimplementation(\"org.zeroturnaround:zt-zip:1.14\")\nimplementation(\"org.apache.commons:commons-text:1.9\")\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Use JGIT 6.1.0.202203080745-r |
426,496 | 20.05.2022 14:17:08 | -7,200 | 3d080e23f8c7e9709ebd913e7a7f8989331a62e7 | Make selecting text on the log output page easier
By not replacing text in the DOM if it didn't change. | [
{
"change_type": "MODIFY",
"old_path": "instances-manager/src/main/resources/static/log/xxx/log.html",
"new_path": "instances-manager/src/main/resources/static/log/xxx/log.html",
"diff": "<script type=\"application/javascript\" src=\"../../jquery-3.6.0.min.js\"></script>\n<script type=\"application/javascript\">\nfunction updateLog() {\n- $.get(\"content\", (data) => {\n- $(\"#log\").text(data)\n+ $.get(\"content\", (newText) => {\n+ let logElement = $(\"#log\");\n+ let oldText = logElement.text()\n+ if (newText != oldText) {\n+ logElement.text(newText)\n+ }\n});\n$.getJSON(\"events\", (data) => {\nlet table = document.getElementById(\"events\");\ntableRow.lastChild.remove()\n}\nfor (let x = 0; x < jsonRow.length; x++) {\n+ if ($(tableRow.children[x]).text() != jsonRow[x]) {\n$(tableRow.children[x]).text(jsonRow[x])\n}\n}\n+ }\n});\n}\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Make selecting text on the log output page easier
By not replacing text in the DOM if it didn't change. |
426,496 | 20.05.2022 15:52:55 | -7,200 | c1f3bade883c1fa7c223e0f878d9e78b35e24cd2 | Just a change to create a new commit, because publishing fails
Publishing to github packages fails: "Received status code 409 from server: Conflict"
Maybe a commit has more luck. | [
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "@@ -99,56 +99,56 @@ It's an operation that happens all the time.\n# Content of the root directory\n-File | Description\n----|---\n-[db](db) | Files for building the PostgreSQL docker image\n-[doc](doc) | Documentation\n-[gradle-plugin](gradle-plugin) | gradle plugin for downloading a model from the model server to an MPS model file\n-[gradle-plugin-test](gradle-plugin-test) | Demo project that uses the gradle plugin.\n-[kubernetes](kubernetes) | YAML configuration files for running Modelix in a kubernetes cluster\n-[model-client](model-client) | Model implementation with real-time collaboration support implemented in kotlin\n-[model-server](model-server) | Java project that implements a REST API on top of an [Apache Ignite](https://ignite.apache.org/) key value store. It is very generic and lightweight and doesn't know anything about models and their storage format. The mapping between the model data structure and the key value entries happens in MPS.\n-[mps](mps) | MPS project that implements all the MPS plugins. That's a plugin for synchronizing models with the model server and plugins for editing models in the browser.\n-[proxy](proxy) | Files for building a docker image for a reverse proxy used inside the kubernetes cluster.\n-[samples](samples) | Projects that show you how to build your own kubernetes cluster running MPS with custom languages.\n-[ssl](ssl) | SSL support inside the kubernetes cluster\n-[ui-client](ui-client) | A typescript project that implements the browser part of the editor. This is generic and doesn't contain anything language specific. All language specific parts are implements on the server side in MPS.\n-[ui-proxy](ui-proxy) | Starts MPS instaces on demand with cloned github repositories. Also supports showing diffs for pull requests.\n-[ui-server](ui-server) | A small Java project that configures and starts MPS in headless mode.\n-[.dockerignore](.dockerignore) |\n-[.gitignore](.gitignore) |\n-[.nvmrc](.nvmrc) | Currently used NVM version\n-[.travis.yml](.travis.yml) | Required for using travis as the CI server: <https://travis-ci.org/github/modelix/modelix>\n-[Dockerfile-mps](Dockerfile-mps) | The docker image for the UI server is split into a separate layer for MPS, because the MPS version changes less frequently and this speeds up the rebuild of the docker image.\n-[Dockerfile-ui](Dockerfile-ui) | For building the docker image of the UI server.\n-[LICENSE](LICENSE) |\n-[README.md](README.md) |\n-[build-scripts.xml](build-scripts.xml) | Generated by MPS for building the MPS project\n-[build.gradle](build.gradle) |\n-[docker-build-all.sh](docker-build-all.sh) | Builds all the docker images. You have to run `./gradlew` first.\n-[docker-build-db.sh](docker-build-db.sh) |\n-[docker-build-model.sh](docker-build-model.sh) |\n-[docker-build-mps.sh](docker-build-mps.sh) |\n-[docker-build-proxy.sh](docker-build-proxy.sh) |\n-[docker-build-ui.sh](docker-build-ui.sh) |\n-[docker-build-uiproxy.sh](docker-build-uiproxy.sh) |\n-[docker-ci.sh](docker-ci.sh) | Is executed by the CI server to publish the docker images for a git tag\n-[docker-run-db.sh](docker-run-db.sh) | If you want to run the PostgresSQL database locally without a kubernetes cluster\n-[generate-modelsecret.sh](generate-modelsecret.sh) | Access to the model server requires clients to be logged in with their google account. Inside the kubernetes cluster the other components use a secret stored in the kubernetes cluster as the access token.\n-[gradlew](gradlew) | Run this to build all projects.\n-[gradlew.bat](gradlew.bat) | Run this to build all projects.\n-[kubernetes-apply-gcloud.sh](kubernetes-apply-gcloud.sh) |\n-[kubernetes-apply-local.sh](kubernetes-apply-local.sh) |\n-[kubernetes-gcloud-dbsecret.sh](kubernetes-gcloud-dbsecret.sh) |\n-[kubernetes-secrets.sh](kubernetes-secrets.sh) |\n-[kubernetes-open-proxy.sh](kubernetes-open-proxy.sh) | Opens Modelix in the browser after loading the kubernetes configuration in docker desktop\n-[kubernetes-use-latest-tag.sh](kubernetes-use-latest-tag.sh) | Use this before [kubernetes-apply-local.sh](kubernetes-apply-local.sh) to update the kubernetes configurations to use the latest Modelix version\n-[modelix-version.sh](modelix-version.sh) | Reads or creates a modelix.version file that is used to tag the docker images\n-[mps-version.properties](mps-version.properties) | The MPS version that Modelix is based on\n-[run-ui-server.sh](run-ui-server.sh) | This is packaged into the docker image and doesn't work outside of it.\n-[settings.gradle](settings.gradle) |\n-[update-gcloud.sh](update-gcloud.sh) | If you want to build and run your own images inside you cluster.\n-[update-minikube.sh](update-minikube.sh) | If you want to build and run your own images inside you cluster.\n+| File | Description |\n+|----------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n+| [db](db) | Files for building the PostgreSQL docker image |\n+| [doc](doc) | Documentation |\n+| [gradle-plugin](gradle-plugin) | gradle plugin for downloading a model from the model server to an MPS model file |\n+| [gradle-plugin-test](gradle-plugin-test) | Demo project that uses the gradle plugin. |\n+| [kubernetes](kubernetes) | YAML configuration files for running Modelix in a kubernetes cluster |\n+| [model-client](model-client) | Model implementation with real-time collaboration support implemented in kotlin |\n+| [model-server](model-server) | Java project that implements a REST API on top of an [Apache Ignite](https://ignite.apache.org/) key value store. It is very generic and lightweight and doesn't know anything about models and their storage format. The mapping between the model data structure and the key value entries happens in MPS. |\n+| [mps](mps) | MPS project that implements all the MPS plugins. That's a plugin for synchronizing models with the model server and plugins for editing models in the browser. |\n+| [proxy](proxy) | Files for building a docker image for a reverse proxy used inside the kubernetes cluster. |\n+| [samples](samples) | Projects that show you how to build your own kubernetes cluster running MPS with custom languages. |\n+| [ssl](ssl) | SSL support inside the kubernetes cluster |\n+| [ui-client](ui-client) | A typescript project that implements the browser part of the editor. This is generic and doesn't contain anything language specific. All language specific parts are implements on the server side in MPS. |\n+| [ui-proxy](ui-proxy) | Starts MPS instaces on demand with cloned github repositories. Also supports showing diffs for pull requests. |\n+| [ui-server](ui-server) | A small Java project that configures and starts MPS in headless mode. |\n+| [.dockerignore](.dockerignore) | |\n+| [.gitignore](.gitignore) | |\n+| [.nvmrc](.nvmrc) | Currently used NVM version |\n+| [.travis.yml](.travis.yml) | Required for using travis as the CI server: <https://travis-ci.org/github/modelix/modelix> |\n+| [Dockerfile-mps](Dockerfile-mps) | The docker image for the UI server is split into a separate layer for MPS, because the MPS version changes less frequently and this speeds up the rebuild of the docker image. |\n+| [Dockerfile-ui](Dockerfile-ui) | For building the docker image of the UI server. |\n+| [LICENSE](LICENSE) | |\n+| [README.md](README.md) | |\n+| [build-scripts.xml](build-scripts.xml) | Generated by MPS for building the MPS project |\n+| [build.gradle](build.gradle) | |\n+| [docker-build-all.sh](docker-build-all.sh) | Builds all the docker images. You have to run `./gradlew` first. |\n+| [docker-build-db.sh](docker-build-db.sh) | |\n+| [docker-build-model.sh](docker-build-model.sh) | |\n+| [docker-build-mps.sh](docker-build-mps.sh) | |\n+| [docker-build-proxy.sh](docker-build-proxy.sh) | |\n+| [docker-build-ui.sh](docker-build-ui.sh) | |\n+| [docker-build-uiproxy.sh](docker-build-uiproxy.sh) | |\n+| [docker-ci.sh](docker-ci.sh) | Is executed by the CI server to publish the docker images for a git tag |\n+| [docker-run-db.sh](docker-run-db.sh) | If you want to run the PostgresSQL database locally without a kubernetes cluster |\n+| [generate-modelsecret.sh](generate-modelsecret.sh) | Access to the model server requires clients to be logged in with their google account. Inside the kubernetes cluster the other components use a secret stored in the kubernetes cluster as the access token. |\n+| [gradlew](gradlew) | Run this to build all projects. |\n+| [gradlew.bat](gradlew.bat) | Run this to build all projects. |\n+| [kubernetes-apply-gcloud.sh](kubernetes-apply-gcloud.sh) | |\n+| [kubernetes-apply-local.sh](kubernetes-apply-local.sh) | |\n+| [kubernetes-gcloud-dbsecret.sh](kubernetes-gcloud-dbsecret.sh) | |\n+| [kubernetes-secrets.sh](kubernetes-secrets.sh) | |\n+| [kubernetes-open-proxy.sh](kubernetes-open-proxy.sh) | Opens Modelix in the browser after loading the kubernetes configuration in docker desktop |\n+| [kubernetes-use-latest-tag.sh](kubernetes-use-latest-tag.sh) | Use this before [kubernetes-apply-local.sh](kubernetes-apply-local.sh) to update the kubernetes configurations to use the latest Modelix version |\n+| [modelix-version.sh](modelix-version.sh) | Reads or creates a modelix.version file that is used to tag the docker images |\n+| [mps-version.properties](mps-version.properties) | The MPS version that Modelix is based on |\n+| [run-ui-server.sh](run-ui-server.sh) | This is packaged into the docker image and doesn't work outside of it. |\n+| [settings.gradle](settings.gradle) | |\n+| [update-gcloud.sh](update-gcloud.sh) | If you want to build and run your own images inside you cluster. |\n+| [update-minikube.sh](update-minikube.sh) | If you want to build and run your own images inside you cluster. |\n# Roadmap\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Just a change to create a new commit, because publishing fails
Publishing to github packages fails: "Received status code 409 from server: Conflict"
Maybe a commit has more luck. |
426,496 | 20.05.2022 16:18:17 | -7,200 | 9528a95eb3dc2cd007dd7a48b273f9295cf352f3 | Disabled publishing to GHP because of "Received status code 409 from server: Conflict" | [
{
"change_type": "MODIFY",
"old_path": "build.gradle",
"new_path": "build.gradle",
"diff": "@@ -107,6 +107,7 @@ subprojects {\npublishing {\nrepositories {\n+ /* Disabled because GHP sometimes keeps failing with \"Received status code 409 from server: Conflict\"\nif (githubCredentials != null) {\nmaven {\nname = \"GitHubPackages\"\n@@ -119,6 +120,7 @@ subprojects {\n}\n}\n}\n+ */\nif (project.hasProperty(\"artifacts.itemis.cloud.user\")) {\nmaven {\nname = \"itemisNexus3\"\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Disabled publishing to GHP because of "Received status code 409 from server: Conflict" |
426,496 | 20.05.2022 17:38:12 | -7,200 | de422dfc82ea9fb343ad7a752fbbdd270cbebfca | Higher timeout for the generator | [
{
"change_type": "MODIFY",
"old_path": "headless-mps/src/main/kotlin/org/modelix/headlessmps/ProcessExecutor.kt",
"new_path": "headless-mps/src/main/kotlin/org/modelix/headlessmps/ProcessExecutor.kt",
"diff": "@@ -19,7 +19,7 @@ import kotlin.math.max\nopen class ProcessExecutor() {\nvar outputHandler: (String)->Unit = { println(it) }\n- var timeoutSeconds: Int = 120\n+ var timeoutSeconds: Int = 300\n@Throws(IOException::class, InterruptedException::class)\nfun exec(command: List<String>) {\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Higher timeout for the generator |
426,496 | 23.05.2022 17:38:10 | -7,200 | f999b3c35365f04b5a6b99a09f28e0787bca60d0 | Rename MPS config directory to match the correct MPS version | [
{
"change_type": "MODIFY",
"old_path": "Dockerfile-projector",
"new_path": "Dockerfile-projector",
"diff": "@@ -7,6 +7,10 @@ COPY build/org.modelix/build/artifacts/org.modelix/plugins/ /mps-plugins/modelix\nRUN /install-plugins.sh /projector/ide/plugins/\nCOPY projector-user-home /home/projector-user\n+# rename config directory to match the correct MPS version\n+RUN MPS_VERSION=$(grep \"mpsBootstrapCore.version=\" /projector/ide/build.properties|cut -d'=' -f2) \\\n+ cd /home/projector-user/.config/JetBrains/ \\\n+ mv \"*\" \"MPS${MPS_VERSION}\"\nCOPY log.xml /projector/ide/bin/log.xml\nRUN chown -R projector-user:projector-user /home/projector-user\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Rename MPS config directory to match the correct MPS version |
426,496 | 23.05.2022 18:24:54 | -7,200 | 7c4c9a8c283f7b02432cc9a7d93f1aa21226896a | fixed NPE when a model version has not timestamp | [
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/kotlin/org/modelix/model/server/HistoryHandler.kt",
"new_path": "model-server/src/main/kotlin/org/modelix/model/server/HistoryHandler.kt",
"diff": "@@ -291,6 +291,7 @@ class HistoryHandler(private val client: IModelClient) : AbstractHandler() {\n}\nprivate fun reformatTime(dateTimeStr: String?): String {\n+ if (dateTimeStr == null) return \"\"\nval dateTime = LocalDateTime.parse(dateTimeStr)\nreturn dateTime.format(DateTimeFormatter.ofPattern(\"yyyy-MM-dd HH:mm\"))\n}\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | fixed NPE when a model version has not timestamp |
426,504 | 01.06.2022 11:26:12 | -7,200 | 4dfc5581efab4f35d11e1c8103caf85cb096fac0 | updating expected dump | [
{
"change_type": "MODIFY",
"old_path": "integrationtests/expected_server_dumps/dump1.json",
"new_path": "integrationtests/expected_server_dumps/dump1.json",
"diff": "\"$concept\": \"org.modelix.model.repositoryconcepts.Module\",\n\"id\": \"f2fb433a-7484-46c7-a61e-ec59ba5ea58f\",\n\"name\": \"simple.solution1\",\n+ \"moduleVersion\": \"0\",\n+ \"compileInMPS\": \"true\",\n\"$children\": [\n{\n\"$role\": \"models\",\n{\n\"$role\": \"usedLanguages\",\n\"$concept\": \"org.modelix.model.repositoryconcepts.UsedModule\",\n- \"id\": \"f3061a53-9226-4cc5-a443-f952ceaf5816\",\n+ \"uuid\": \"f3061a53-9226-4cc5-a443-f952ceaf5816\",\n\"name\": \"jetbrains.mps.baseLanguage\"\n},\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "integrationtests/expected_server_dumps/dump_project1.json",
"new_path": "integrationtests/expected_server_dumps/dump_project1.json",
"diff": "\"$children\": [\n{\n\"$role\": \"usedLanguages\",\n- \"$concept\": \"org.modelix.model.repositoryconcepts.UsedModule\",\n- \"id\": \"f3061a53-9226-4cc5-a443-f952ceaf5816\",\n- \"name\": \"jetbrains.mps.baseLanguage\"\n+ \"$concept\": \"org.modelix.model.repositoryconcepts.SingleLanguageDependency\",\n+ \"uuid\": \"f3061a53-9226-4cc5-a443-f952ceaf5816\",\n+ \"name\": \"jetbrains.mps.baseLanguage\",\n+ \"version\": \"11\"\n},\n{\n\"$role\": \"rootNodes\",\n"
},
{
"change_type": "MODIFY",
"old_path": "integrationtests/expected_server_dumps/dump_project2.json",
"new_path": "integrationtests/expected_server_dumps/dump_project2.json",
"diff": "\"$children\": [\n{\n\"$role\": \"usedLanguages\",\n- \"$concept\": \"org.modelix.model.repositoryconcepts.UsedModule\",\n- \"id\": \"f3061a53-9226-4cc5-a443-f952ceaf5816\",\n- \"name\": \"jetbrains.mps.baseLanguage\"\n+ \"$concept\": \"org.modelix.model.repositoryconcepts.SingleLanguageDependency\",\n+ \"uuid\": \"f3061a53-9226-4cc5-a443-f952ceaf5816\",\n+ \"name\": \"jetbrains.mps.baseLanguage\",\n+ \"version\": \"11\"\n},\n{\n\"$role\": \"rootNodes\",\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | updating expected dump |
426,504 | 02.06.2022 10:12:37 | -7,200 | e5f389eb6c2aec4ddd2e0e77ad8cdef506cb926e | correct removal of model imports | [
{
"change_type": "MODIFY",
"old_path": "mps/org.modelix.model.mpsplugin/models/org.modelix.model.mpsplugin.mps",
"new_path": "mps/org.modelix.model.mpsplugin/models/org.modelix.model.mpsplugin.mps",
"diff": "<ref role=\"3cqZAo\" node=\"ON_jCgb8EO\" resolve=\"dependenciesInMPS\" />\n</node>\n<node concept=\"3clFbS\" id=\"ON_jCgb8GW\" role=\"2LFqv$\">\n+ <node concept=\"3clFbH\" id=\"66kvSbiiwL9\" role=\"3cqZAp\" />\n<node concept=\"3cpWs8\" id=\"ON_jCgb8GX\" role=\"3cqZAp\">\n<node concept=\"3cpWsn\" id=\"ON_jCgb8GY\" role=\"3cpWs9\">\n<property role=\"TrG5h\" value=\"matchingDependencyInCloud\" />\n<node concept=\"3uibUv\" id=\"ON_jCgb8GZ\" role=\"1tU5fm\">\n<ref role=\"3uigEE\" to=\"jks5:~INode\" resolve=\"INode\" />\n</node>\n- <node concept=\"2OqwBi\" id=\"ON_jCgb8H0\" role=\"33vP2m\">\n- <node concept=\"37vLTw\" id=\"ON_jCgctxc\" role=\"2Oq$k0\">\n+ <node concept=\"10Nm6u\" id=\"66kvSbiizMh\" role=\"33vP2m\" />\n+ </node>\n+ </node>\n+ <node concept=\"2Gpval\" id=\"66kvSbii_dh\" role=\"3cqZAp\">\n+ <node concept=\"2GrKxI\" id=\"66kvSbii_dj\" role=\"2Gsz3X\">\n+ <property role=\"TrG5h\" value=\"dependencyInCloud\" />\n+ </node>\n+ <node concept=\"37vLTw\" id=\"66kvSbii_SQ\" role=\"2GsD0m\">\n<ref role=\"3cqZAo\" node=\"ON_jCgb8Fm\" resolve=\"dependenciesInCloud\" />\n</node>\n- <node concept=\"1z4cxt\" id=\"ON_jCgb8H2\" role=\"2OqNvi\">\n- <node concept=\"1bVj0M\" id=\"ON_jCgb8H3\" role=\"23t8la\">\n- <node concept=\"3clFbS\" id=\"ON_jCgb8H4\" role=\"1bW5cS\">\n- <node concept=\"3clFbF\" id=\"ON_jCgb8H5\" role=\"3cqZAp\">\n- <node concept=\"17R0WA\" id=\"ON_jCgb8H6\" role=\"3clFbG\">\n- <node concept=\"2OqwBi\" id=\"ON_jCgb8H7\" role=\"3uHU7B\">\n- <node concept=\"2GrUjf\" id=\"ON_jCgb8H8\" role=\"2Oq$k0\">\n+ <node concept=\"3clFbS\" id=\"66kvSbii_dn\" role=\"2LFqv$\">\n+ <node concept=\"3clFbJ\" id=\"66kvSbiiACq\" role=\"3cqZAp\">\n+ <node concept=\"3clFbS\" id=\"66kvSbiiACs\" role=\"3clFbx\">\n+ <node concept=\"3clFbF\" id=\"66kvSbiiCf7\" role=\"3cqZAp\">\n+ <node concept=\"37vLTI\" id=\"66kvSbiiCVu\" role=\"3clFbG\">\n+ <node concept=\"2GrUjf\" id=\"66kvSbiiEU5\" role=\"37vLTx\">\n+ <ref role=\"2Gs0qQ\" node=\"66kvSbii_dj\" resolve=\"dependencyInCloud\" />\n+ </node>\n+ <node concept=\"37vLTw\" id=\"66kvSbiiCf6\" role=\"37vLTJ\">\n+ <ref role=\"3cqZAo\" node=\"ON_jCgb8GY\" resolve=\"matchingDependencyInCloud\" />\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ <node concept=\"17R0WA\" id=\"66kvSbiiAG$\" role=\"3clFbw\">\n+ <node concept=\"2OqwBi\" id=\"66kvSbiiAG_\" role=\"3uHU7B\">\n+ <node concept=\"2GrUjf\" id=\"66kvSbiiAGA\" role=\"2Oq$k0\">\n<ref role=\"2Gs0qQ\" node=\"ON_jCgb8GU\" resolve=\"dependencyInMPS\" />\n</node>\n- <node concept=\"liA8E\" id=\"ON_jCgb8H9\" role=\"2OqNvi\">\n+ <node concept=\"liA8E\" id=\"66kvSbiiAGB\" role=\"2OqNvi\">\n<ref role=\"37wK5l\" to=\"xxte:25OQfQHQeFB\" resolve=\"getPropertyValue\" />\n- <node concept=\"2OqwBi\" id=\"ON_jCgb8Ha\" role=\"37wK5m\">\n- <node concept=\"355D3s\" id=\"ON_jCgb8Hb\" role=\"2Oq$k0\">\n- <ref role=\"355D3u\" to=\"jh6v:7LiskgSqGCi\" resolve=\"uuid\" />\n+ <node concept=\"2OqwBi\" id=\"66kvSbiiAGC\" role=\"37wK5m\">\n+ <node concept=\"355D3s\" id=\"66kvSbiiAGD\" role=\"2Oq$k0\">\n<ref role=\"355D3t\" to=\"jh6v:1UvRDkPap5X\" resolve=\"SingleLanguageDependency\" />\n+ <ref role=\"355D3u\" to=\"jh6v:7LiskgSqGCi\" resolve=\"uuid\" />\n</node>\n- <node concept=\"liA8E\" id=\"ON_jCgb8Hc\" role=\"2OqNvi\">\n+ <node concept=\"liA8E\" id=\"66kvSbiiAGE\" role=\"2OqNvi\">\n<ref role=\"37wK5l\" to=\"c17a:~SProperty.getName()\" resolve=\"getName\" />\n</node>\n</node>\n</node>\n</node>\n- <node concept=\"2OqwBi\" id=\"ON_jCgb8Hd\" role=\"3uHU7w\">\n- <node concept=\"37vLTw\" id=\"ON_jCgb8He\" role=\"2Oq$k0\">\n- <ref role=\"3cqZAo\" node=\"ON_jCgb8Hj\" resolve=\"dependencyInCloud\" />\n+ <node concept=\"2OqwBi\" id=\"66kvSbiiAGF\" role=\"3uHU7w\">\n+ <node concept=\"2GrUjf\" id=\"66kvSbiiB$p\" role=\"2Oq$k0\">\n+ <ref role=\"2Gs0qQ\" node=\"66kvSbii_dj\" resolve=\"dependencyInCloud\" />\n</node>\n- <node concept=\"liA8E\" id=\"ON_jCgb8Hf\" role=\"2OqNvi\">\n+ <node concept=\"liA8E\" id=\"66kvSbiiAGH\" role=\"2OqNvi\">\n<ref role=\"37wK5l\" to=\"jks5:~INode.getPropertyValue(java.lang.String)\" resolve=\"getPropertyValue\" />\n- <node concept=\"2OqwBi\" id=\"ON_jCgb8Hg\" role=\"37wK5m\">\n- <node concept=\"355D3s\" id=\"ON_jCgb8Hh\" role=\"2Oq$k0\">\n- <ref role=\"355D3u\" to=\"jh6v:7LiskgSqGCi\" resolve=\"uuid\" />\n+ <node concept=\"2OqwBi\" id=\"66kvSbiiAGI\" role=\"37wK5m\">\n+ <node concept=\"355D3s\" id=\"66kvSbiiAGJ\" role=\"2Oq$k0\">\n<ref role=\"355D3t\" to=\"jh6v:1UvRDkPap5X\" resolve=\"SingleLanguageDependency\" />\n+ <ref role=\"355D3u\" to=\"jh6v:7LiskgSqGCi\" resolve=\"uuid\" />\n</node>\n- <node concept=\"liA8E\" id=\"ON_jCgb8Hi\" role=\"2OqNvi\">\n+ <node concept=\"liA8E\" id=\"66kvSbiiAGK\" role=\"2OqNvi\">\n<ref role=\"37wK5l\" to=\"c17a:~SProperty.getName()\" resolve=\"getName\" />\n</node>\n</node>\n</node>\n</node>\n</node>\n- <node concept=\"Rh6nW\" id=\"ON_jCgb8Hj\" role=\"1bW2Oz\">\n- <property role=\"TrG5h\" value=\"dependencyInCloud\" />\n- <node concept=\"2jxLKc\" id=\"ON_jCgb8Hk\" role=\"1tU5fm\" />\n- </node>\n- </node>\n- </node>\n- </node>\n- </node>\n</node>\n<node concept=\"3clFbJ\" id=\"ON_jCgb8Hl\" role=\"3cqZAp\">\n<node concept=\"3clFbS\" id=\"ON_jCgb8Hm\" role=\"3clFbx\">\n<node concept=\"2YIFZM\" id=\"1KFUeW2rA77\" role=\"33vP2m\">\n<ref role=\"37wK5l\" to=\"2k9e:~MetaAdapterFactory.getLanguage(org.jetbrains.mps.openapi.module.SModuleReference)\" resolve=\"getLanguage\" />\n<ref role=\"1Pybhc\" to=\"2k9e:~MetaAdapterFactory\" resolve=\"MetaAdapterFactory\" />\n- <node concept=\"2OqwBi\" id=\"1KFUeW2pNYl\" role=\"37wK5m\">\n- <node concept=\"37vLTw\" id=\"1KFUeW2pNYm\" role=\"2Oq$k0\">\n- <ref role=\"3cqZAo\" node=\"1KFUeW2pL2G\" resolve=\"depToRemove\" />\n- </node>\n- <node concept=\"liA8E\" id=\"1KFUeW2pNYn\" role=\"2OqNvi\">\n- <ref role=\"37wK5l\" to=\"xxte:1KFUeW2nK2e\" resolve=\"getModuleReference\" />\n- </node>\n+ <node concept=\"37vLTw\" id=\"66kvSbihbFV\" role=\"37wK5m\">\n+ <ref role=\"3cqZAo\" node=\"1KFUeW2rRx8\" resolve=\"moduleReference\" />\n</node>\n</node>\n</node>\n</node>\n<node concept=\"3clFbJ\" id=\"ON_jCgcAtx\" role=\"3cqZAp\">\n<node concept=\"3clFbS\" id=\"ON_jCgcAty\" role=\"3clFbx\">\n- <node concept=\"1X3_iC\" id=\"1KFUeW2mnGi\" role=\"lGtFl\">\n- <property role=\"3V$3am\" value=\"statement\" />\n- <property role=\"3V$3ak\" value=\"f3061a53-9226-4cc5-a443-f952ceaf5816/1068580123136/1068581517665\" />\n- <node concept=\"3cpWs8\" id=\"1KFUeW2mn5J\" role=\"8Wnug\">\n- <node concept=\"3cpWsn\" id=\"1KFUeW2mn5K\" role=\"3cpWs9\">\n+ <node concept=\"3cpWs8\" id=\"66kvSbil852\" role=\"3cqZAp\">\n+ <node concept=\"3cpWsn\" id=\"66kvSbil853\" role=\"3cpWs9\">\n<property role=\"TrG5h\" value=\"dsmd\" />\n- <node concept=\"3uibUv\" id=\"1KFUeW2mn5L\" role=\"1tU5fm\">\n+ <node concept=\"3uibUv\" id=\"66kvSbil854\" role=\"1tU5fm\">\n<ref role=\"3uigEE\" to=\"w1kc:~DefaultSModelDescriptor\" resolve=\"DefaultSModelDescriptor\" />\n</node>\n- <node concept=\"1eOMI4\" id=\"1KFUeW2mn5M\" role=\"33vP2m\">\n- <node concept=\"10QFUN\" id=\"1KFUeW2mn5N\" role=\"1eOMHV\">\n- <node concept=\"3uibUv\" id=\"1KFUeW2mn5O\" role=\"10QFUM\">\n+ <node concept=\"1eOMI4\" id=\"66kvSbil855\" role=\"33vP2m\">\n+ <node concept=\"10QFUN\" id=\"66kvSbil856\" role=\"1eOMHV\">\n+ <node concept=\"3uibUv\" id=\"66kvSbil857\" role=\"10QFUM\">\n<ref role=\"3uigEE\" to=\"w1kc:~DefaultSModelDescriptor\" resolve=\"DefaultSModelDescriptor\" />\n</node>\n- <node concept=\"2OqwBi\" id=\"1KFUeW2mn5P\" role=\"10QFUP\">\n- <node concept=\"37vLTw\" id=\"1KFUeW2mn5Q\" role=\"2Oq$k0\">\n+ <node concept=\"2OqwBi\" id=\"66kvSbil858\" role=\"10QFUP\">\n+ <node concept=\"37vLTw\" id=\"66kvSbil859\" role=\"2Oq$k0\">\n<ref role=\"3cqZAo\" node=\"ON_jCgcApR\" resolve=\"mpsModelNode\" />\n</node>\n- <node concept=\"liA8E\" id=\"1KFUeW2mn5R\" role=\"2OqNvi\">\n+ <node concept=\"liA8E\" id=\"66kvSbil85a\" role=\"2OqNvi\">\n<ref role=\"37wK5l\" to=\"xxte:qmkA5fQFVR\" resolve=\"getElement\" />\n</node>\n</node>\n</node>\n</node>\n</node>\n+ <node concept=\"3cpWs8\" id=\"66kvSbil85b\" role=\"3cqZAp\">\n+ <node concept=\"3cpWsn\" id=\"66kvSbil85c\" role=\"3cpWs9\">\n+ <property role=\"TrG5h\" value=\"depToRemove\" />\n+ <node concept=\"3uibUv\" id=\"66kvSbil9rM\" role=\"1tU5fm\">\n+ <ref role=\"3uigEE\" to=\"xxte:5zrTIjkXNdW\" resolve=\"ModelImportAsNode\" />\n</node>\n- <node concept=\"3clFbF\" id=\"ON_jCgcAtz\" role=\"3cqZAp\">\n- <node concept=\"2OqwBi\" id=\"ON_jCgcAt$\" role=\"3clFbG\">\n- <node concept=\"37vLTw\" id=\"ON_jCgd0Bq\" role=\"2Oq$k0\">\n- <ref role=\"3cqZAo\" node=\"ON_jCgcApR\" resolve=\"mpsModelNode\" />\n- </node>\n- <node concept=\"liA8E\" id=\"ON_jCgcAtA\" role=\"2OqNvi\">\n- <ref role=\"37wK5l\" to=\"xxte:7vWAzuF7Bjm\" resolve=\"removeChild\" />\n- <node concept=\"2GrUjf\" id=\"ON_jCgcAtB\" role=\"37wK5m\">\n+ <node concept=\"2GrUjf\" id=\"66kvSbil85e\" role=\"33vP2m\">\n<ref role=\"2Gs0qQ\" node=\"ON_jCgcAsz\" resolve=\"dependencyInMPS\" />\n</node>\n</node>\n</node>\n+ <node concept=\"3cpWs8\" id=\"66kvSbilgUT\" role=\"3cqZAp\">\n+ <node concept=\"3cpWsn\" id=\"66kvSbilgUW\" role=\"3cpWs9\">\n+ <property role=\"TrG5h\" value=\"modelReferenceToRemove\" />\n+ <node concept=\"3uibUv\" id=\"66kvSbig49e\" role=\"1tU5fm\">\n+ <ref role=\"3uigEE\" to=\"mhbf:~SModelReference\" resolve=\"SModelReference\" />\n+ </node>\n+ <node concept=\"2OqwBi\" id=\"66kvSbilpvx\" role=\"33vP2m\">\n+ <node concept=\"2OqwBi\" id=\"66kvSbillGO\" role=\"2Oq$k0\">\n+ <node concept=\"37vLTw\" id=\"66kvSbilkRR\" role=\"2Oq$k0\">\n+ <ref role=\"3cqZAo\" node=\"66kvSbil85c\" resolve=\"depToRemove\" />\n+ </node>\n+ <node concept=\"liA8E\" id=\"66kvSbilpbU\" role=\"2OqNvi\">\n+ <ref role=\"37wK5l\" to=\"xxte:qmkA5fQFVR\" resolve=\"getElement\" />\n+ </node>\n+ </node>\n+ <node concept=\"liA8E\" id=\"66kvSbilpPN\" role=\"2OqNvi\">\n+ <ref role=\"37wK5l\" to=\"mhbf:~SModel.getReference()\" resolve=\"getReference\" />\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ <node concept=\"3clFbF\" id=\"66kvSbilbX3\" role=\"3cqZAp\">\n+ <node concept=\"2OqwBi\" id=\"66kvSbildxX\" role=\"3clFbG\">\n+ <node concept=\"37vLTw\" id=\"66kvSbilbX1\" role=\"2Oq$k0\">\n+ <ref role=\"3cqZAo\" node=\"66kvSbil853\" resolve=\"dsmd\" />\n+ </node>\n+ <node concept=\"liA8E\" id=\"66kvSbileBe\" role=\"2OqNvi\">\n+ <ref role=\"37wK5l\" to=\"g3l6:~SModelDescriptorStub.deleteModelImport(org.jetbrains.mps.openapi.model.SModelReference)\" resolve=\"deleteModelImport\" />\n+ <node concept=\"37vLTw\" id=\"66kvSbiliwh\" role=\"37wK5m\">\n+ <ref role=\"3cqZAo\" node=\"66kvSbilgUW\" resolve=\"modelReferenceToRemove\" />\n+ </node>\n+ </node>\n+ </node>\n</node>\n</node>\n<node concept=\"3clFbC\" id=\"ON_jCgcAtC\" role=\"3clFbw\">\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | correct removal of model imports |
426,496 | 03.06.2022 09:45:14 | -7,200 | 9fd4a4b978b9558e561912231286ba7874f7c4ca | New sub-projects for authorization | [
{
"change_type": "MODIFY",
"old_path": ".idea/codeStyles/Project.xml",
"new_path": ".idea/codeStyles/Project.xml",
"diff": "<option name=\"CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND\" value=\"100\" />\n<option name=\"NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND\" value=\"100\" />\n</JavaCodeStyleSettings>\n+ <JetCodeStyleSettings>\n+ <option name=\"CODE_STYLE_DEFAULTS\" value=\"KOTLIN_OFFICIAL\" />\n+ </JetCodeStyleSettings>\n<codeStyleSettings language=\"kotlin\">\n+ <option name=\"CODE_STYLE_DEFAULTS\" value=\"KOTLIN_OFFICIAL\" />\n<indentOptions>\n<option name=\"CONTINUATION_INDENT_SIZE\" value=\"4\" />\n</indentOptions>\n"
},
{
"change_type": "MODIFY",
"old_path": ".idea/gradle.xml",
"new_path": ".idea/gradle.xml",
"diff": "<option name=\"modules\">\n<set>\n<option value=\"$PROJECT_DIR$\" />\n+ <option value=\"$PROJECT_DIR$/authorization\" />\n+ <option value=\"$PROJECT_DIR$/authorization-ui\" />\n<option value=\"$PROJECT_DIR$/gitui\" />\n<option value=\"$PROJECT_DIR$/gradle-plugin\" />\n<option value=\"$PROJECT_DIR$/graphql-server\" />\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "authorization-ui/build.gradle.kts",
"diff": "+import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar\n+\n+description = \"Library that checks is allowed to do something\"\n+\n+plugins {\n+ kotlin(\"jvm\")\n+ kotlin(\"plugin.serialization\")\n+ id(\"application\")\n+ id(\"com.github.johnrengelman.shadow\") version \"6.1.0\"\n+}\n+\n+application {\n+ mainClass.set(\"io.ktor.server.netty.EngineMain\")\n+ mainClassName = \"io.ktor.server.netty.EngineMain\"\n+}\n+\n+tasks.withType<ShadowJar> {\n+ archiveVersion.set(\"latest\")\n+}\n+\n+dependencies {\n+ implementation(\"org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.3\")\n+ implementation(\"com.charleskorn.kaml:kaml:0.44.0\")\n+ implementation(project(\":authorization\"))\n+ val ktorVersion = \"1.6.5\"\n+ implementation(\"io.ktor\", \"ktor-server-core\", ktorVersion)\n+ implementation(\"io.ktor\", \"ktor-server-netty\", ktorVersion)\n+ implementation(\"io.ktor\", \"ktor-html-builder\", ktorVersion)\n+ implementation(\"ch.qos.logback\", \"logback-classic\", \"1.2.1\")\n+}\n+\n+tasks.getByName<Test>(\"test\") {\n+ useJUnitPlatform()\n+}\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "authorization-ui/src/main/kotlin/org/modelix/authorization/ui/Application.kt",
"diff": "+/*\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package org.modelix.authorization.ui\n+\n+fun main(args: Array<String>): Unit = io.ktor.server.netty.EngineMain.main(args)\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "authorization-ui/src/main/kotlin/org/modelix/authorization/ui/AuthorizationModule.kt",
"diff": "+/*\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * https://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package org.modelix.authorization.ui\n+\n+import io.ktor.application.*\n+import io.ktor.features.*\n+import io.ktor.html.*\n+import io.ktor.http.*\n+import io.ktor.request.*\n+import io.ktor.response.*\n+import io.ktor.routing.*\n+import kotlinx.html.*\n+import org.modelix.authorization.*\n+\n+fun Application.authorizationModule() {\n+\n+ install(Routing)\n+\n+ routing {\n+ get(\"/\") {\n+ val data = ModelixAuthorization.getData()\n+ call.respondHtml {\n+ body {\n+ form(action = \"update\", method = FormMethod.post) {\n+ h1 { +\"Known Users\" }\n+ table {\n+ for (userId in data.knownUsers) {\n+ tr {\n+ td {\n+ checkBoxInput(name = \"user\") { value = userId }\n+ +userId\n+ }\n+ }\n+ }\n+ tr {\n+ td {\n+ textInput(name = \"new-user-id\")\n+ submitInput(name = \"add-user\") { value = \"+\" }\n+ }\n+ }\n+ }\n+ h1 { +\"Known Groups\" }\n+ table {\n+ for (groupId in data.knownGroups) {\n+ tr {\n+ td {\n+ checkBoxInput(name = \"group\") { value = groupId }\n+ +groupId\n+ }\n+ }\n+ }\n+ tr {\n+ td {\n+ textInput(name = \"new-group-id\")\n+ submitInput(name = \"add-group\") { value = \"+\" }\n+ }\n+ }\n+ }\n+ h1 { +\"Known Permissions\" }\n+ table {\n+ for (permissionId in data.getAllKnownPermissions().sortedBy { it.id }) {\n+ tr {\n+ td {\n+ checkBoxInput(name = \"permission\") { value = permissionId.id }\n+ +permissionId.id\n+ }\n+ }\n+ }\n+ tr {\n+ td {\n+ textInput(name = \"new-permission-id\")\n+ submitInput(name = \"add-permission\") { value = \"+\" }\n+ }\n+ }\n+ }\n+ div {\n+ +\"Grant \"\n+ for (type in EPermissionType.values()) {\n+ submitInput(name = \"type\") { value = type.name }\n+ }\n+ +\" access\"\n+ }\n+ }\n+ h1 { +\"Granted Permissions\" }\n+ table {\n+ for (grantedPermission in data.grantedPermissions) {\n+ tr {\n+ td { +grantedPermission.userOrGroupId }\n+ td { +grantedPermission.type.name }\n+ td { +grantedPermission.permissionId.id }\n+ }\n+ }\n+ }\n+ }\n+ }\n+ }\n+\n+ post(\"update\") {\n+ val params: Parameters = call.receiveParameters()\n+ var data = ModelixAuthorization.getData()\n+ if (params.contains(\"type\")) {\n+ val users = params.getAll(\"user\") ?: emptyList()\n+ val groups = params.getAll(\"group\") ?: emptyList()\n+ val permissions = params.getAll(\"permission\")?.map { PermissionId(it) } ?: emptyList()\n+ val type = params[\"type\"]?.let { EPermissionType.valueOf(it) }\n+ if (type != null) {\n+ for (permission in permissions) {\n+ for (user in users) {\n+ data = data.withGrantedPermission(PermissionData(user, permission, type))\n+ }\n+ for (group in groups) {\n+ data = data.withGrantedPermission(PermissionData(group, permission, type))\n+ }\n+ }\n+ }\n+ } else if (params.contains(\"add-user\")) {\n+ val id = params[\"new-user-id\"]\n+ if (id != null) {\n+ data = data.withUser(id)\n+ }\n+ } else if (params.contains(\"add-group\")) {\n+ val id = params[\"new-group-id\"]\n+ if (id != null) {\n+ data = data.withGroup(id)\n+ }\n+ } else if (params.contains(\"add-permission\")) {\n+ val id = params[\"new-permission-id\"]\n+ if (id != null) {\n+ data = data.withPermission(PermissionId(id))\n+ }\n+ }\n+ ModelixAuthorization.storeData(data)\n+ call.respondRedirect(\".\")\n+ }\n+ }\n+\n+ install(CORS) {\n+ anyHost()\n+ header(HttpHeaders.ContentType)\n+ method(HttpMethod.Options)\n+ method(HttpMethod.Get)\n+ method(HttpMethod.Put)\n+ method(HttpMethod.Post)\n+ }\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "authorization-ui/src/main/resources/application.conf",
"diff": "+ktor {\n+ deployment {\n+ port = 28143\n+ }\n+ application {\n+ modules = [\n+ org.modelix.authorization.ui.AuthorizationModuleKt.authorizationModule\n+ ]\n+ }\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "authorization-ui/src/main/resources/logback.xml",
"diff": "+<configuration>\n+ <appender name=\"STDOUT\" class=\"ch.qos.logback.core.ConsoleAppender\">\n+ <encoder>\n+ <pattern>%d{YYYY-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>\n+ </encoder>\n+ </appender>\n+ <root level=\"trace\">\n+ <appender-ref ref=\"STDOUT\"/>\n+ </root>\n+ <logger name=\"org.eclipse.jetty\" level=\"INFO\"/>\n+ <logger name=\"io.netty\" level=\"INFO\"/>\n+</configuration>\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "authorization/build.gradle.kts",
"diff": "+description = \"Library that checks is allowed to do something\"\n+\n+plugins {\n+ kotlin(\"jvm\")\n+ kotlin(\"plugin.serialization\")\n+}\n+\n+dependencies {\n+ implementation(\"org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2\")\n+ implementation(\"com.charleskorn.kaml:kaml:0.40.0\")\n+ implementation(project(\":model-client\", configuration = \"jvmRuntimeElements\"))\n+}\n+\n+tasks.getByName<Test>(\"test\") {\n+ useJUnitPlatform()\n+}\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "authorization/src/main/kotlin/org/modelix/authorization/AuthenticatedUser.kt",
"diff": "+/*\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.modelix.authorization\n+\n+class AuthenticatedUser(val userId: String, val groups: Set<String>) {\n+ fun getUserAndGroupIds(): Sequence<String> = groups.asSequence() + userId\n+}\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "authorization/src/main/kotlin/org/modelix/authorization/AuthorizationData.kt",
"diff": "+/*\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.modelix.authorization\n+\n+@JvmInline\[email protected]\n+value class PermissionId(val id: String)\n+\[email protected]\n+data class AuthorizationData(\n+ val knownUsers: Set<String>,\n+ val knownGroups: Set<String>,\n+ val knownPermissions: Set<PermissionId>,\n+ val grantedPermissions: List<PermissionData>\n+) {\n+ fun getAllKnownPermissions(): Set<PermissionId> = knownPermissions + grantedPermissions.map { it.permissionId }\n+ fun withGrantedPermission(grant: PermissionData) = AuthorizationData(\n+ knownUsers, knownGroups, knownPermissions, (grantedPermissions + grant).distinct()\n+ )\n+ fun withUser(id: String) = AuthorizationData(knownUsers + id, knownGroups, knownPermissions, grantedPermissions)\n+ fun withGroup(id: String) = AuthorizationData(knownUsers, knownGroups + id, knownPermissions, grantedPermissions)\n+ fun withPermission(id: PermissionId) = AuthorizationData(knownUsers, knownGroups, knownPermissions + id, grantedPermissions)\n+}\n+\[email protected]\n+data class PermissionData(val userOrGroupId: String, val permissionId: PermissionId, val type: EPermissionType)\n+\n+enum class EPermissionType(vararg val includedTypes: EPermissionType) {\n+ READ,\n+ WRITE(READ);\n+\n+ fun includes(type: EPermissionType): Boolean = type == this || includedTypes.any { it.includes(type) }\n+}\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "authorization/src/main/kotlin/org/modelix/authorization/IAuthorizationPersistence.kt",
"diff": "+/*\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.modelix.authorization\n+\n+import kotlinx.serialization.decodeFromString\n+import kotlinx.serialization.encodeToString\n+import kotlinx.serialization.json.Json\n+\n+interface IAuthorizationPersistence {\n+ fun loadData(): AuthorizationData?\n+ fun storeData(data: AuthorizationData)\n+}\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "authorization/src/main/kotlin/org/modelix/authorization/ModelServerAuthorizationPersistence.kt",
"diff": "+/*\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.modelix.authorization\n+\n+import kotlinx.serialization.decodeFromString\n+import kotlinx.serialization.encodeToString\n+import kotlinx.serialization.json.Json\n+import org.modelix.model.client.IModelClient\n+import org.modelix.model.client.RestWebModelClient\n+\n+private fun getModelServerUrl(): String {\n+ return listOf(\"model.server.url\", \"model_server_url\")\n+ .flatMap { listOf(System.getProperty(it), System.getenv(it)) }\n+ .filterNotNull()\n+ .firstOrNull() ?: \"http://localhost:28101/\"\n+}\n+\n+class ModelServerAuthorizationPersistence(val client: IModelClient, val dataKey: String) : IAuthorizationPersistence {\n+\n+ constructor(modelServerUrl: String?, dataKey: String)\n+ : this(RestWebModelClient(modelServerUrl ?: getModelServerUrl()), dataKey)\n+\n+ constructor() : this(null, \"authorization-data\")\n+\n+ override fun loadData(): AuthorizationData? {\n+ val serialized = client.get(dataKey) ?: return null\n+ return Json.decodeFromString<AuthorizationData>(serialized)\n+ }\n+\n+ override fun storeData(data: AuthorizationData) {\n+ client.put(dataKey, Json.encodeToString(data))\n+ }\n+}\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "authorization/src/main/kotlin/org/modelix/authorization/ModelixAuthorization.kt",
"diff": "+/*\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.modelix.authorization\n+\n+import kotlinx.serialization.json.Json\n+import org.modelix.model.client.IModelClient\n+import org.modelix.model.client.RestWebModelClient\n+import kotlinx.serialization.decodeFromString\n+import kotlinx.serialization.encodeToString\n+\n+object ModelixAuthorization {\n+ private val ADMIN_GROUP = \"modelix-administrators\"\n+ private val PUBLIC_GROUP = \"modelix-public\"\n+ private val ANONYMOUS_USER_ID = \"modelix-anonymous\"\n+ private val ANONYMOUS_USER = AuthenticatedUser(ANONYMOUS_USER_ID, setOf(PUBLIC_GROUP))\n+\n+ var persistence: IAuthorizationPersistence = ModelServerAuthorizationPersistence()\n+\n+ fun getData(): AuthorizationData {\n+ return persistence.loadData()\n+ ?: AuthorizationData(setOf(ANONYMOUS_USER_ID), setOf(ADMIN_GROUP, PUBLIC_GROUP), emptySet(), emptyList())\n+ }\n+\n+ fun storeData(data: AuthorizationData) {\n+ persistence.storeData(data)\n+ }\n+\n+ fun getPermissions(user: AuthenticatedUser, permissionId: PermissionId): Set<EPermissionType> {\n+ val userAndGroupIds = user.getUserAndGroupIds() + PUBLIC_GROUP\n+ return getData().grantedPermissions\n+ .filter { it.permissionId == permissionId && userAndGroupIds.contains(it.userOrGroupId) }\n+ .map { it.type }.toSet()\n+ }\n+\n+ fun hasPermission(user: AuthenticatedUser, permissionId: PermissionId, type: EPermissionType): Boolean {\n+ return getPermissions(user, permissionId).any { it.includes(type) }\n+ }\n+}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "kubernetes/common/workspace-client-deployment.yaml",
"new_path": "kubernetes/common/workspace-client-deployment.yaml",
"diff": "@@ -25,7 +25,7 @@ spec:\nspec:\ncontainers:\n- name: workspace-client\n- image: modelix/modelix-workspace-client:2020.3.5-202202061327-SNAPSHOT\n+ image: modelix/modelix-workspace-client:2020.3.5-202205231600-SNAPSHOT\nimagePullPolicy: IfNotPresent\nenv:\n- name: \"modelix_executionMode\"\n"
},
{
"change_type": "MODIFY",
"old_path": "settings.gradle",
"new_path": "settings.gradle",
"diff": "@@ -15,3 +15,5 @@ include 'workspace-manager'\ninclude 'workspace-client'\ninclude 'headless-mps'\ninclude 'gitui'\n+include 'authorization'\n+include 'authorization-ui'\n"
},
{
"change_type": "DELETE",
"old_path": "workspace-manager/generator-test-project-build.xml",
"new_path": null,
"diff": "-<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n-<project default=\"generate\">\n- <property location=\"/Users/slisson/mps/mps203/modelix/artifacts/mps\" name=\"mps.home\"/>\n- <property location=\"${mps.home}\" name=\"mps_home\"/>\n- <property location=\"${mps.home}\" name=\"artifacts.mps\"/>\n- <path id=\"path.mps.ant.path\">\n- <pathelement location=\"${mps.home}/lib/ant/lib/ant-mps.jar\"/>\n- <pathelement location=\"${mps.home}/lib/log4j.jar\"/>\n- <pathelement location=\"${mps.home}/lib/jdom.jar\"/>\n- </path>\n- <target depends=\"declare-mps-tasks\" name=\"generate\">\n- <echo message=\"generating\"/>\n- <generate createStaticRefs=\"false\" fork=\"true\" hideWarnings=\"false\" logLevel=\"warn\" parallelMode=\"false\" skipUnmodifiedModels=\"false\" strictMode=\"false\" targetJavaVersion=\"11\" useInplaceTransform=\"false\">\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/mps-stubs.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/baseLanguage/jetbrains.mps.baseLanguage.logging.runtime.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/baseLanguage/jetbrains.mps.baseLanguage.tuples.runtime.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/runtimes/jetbrains.mps.lang.behavior.runtime.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/runtimes/jetbrains.mps.lang.constraints.rules.runtime.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/runtimes/jetbrains.mps.lang.feedback.problem.rt.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/runtimes/jetbrains.mps.lang.feedback.api.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/runtimes/jetbrains.mps.lang.feedback.problem.rules.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/runtimes/jetbrains.mps.lang.messages.api.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.descriptor.aspects.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/baseLanguage/jetbrains.mps.baseLanguage.regexp.runtime.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.typesystemEngine.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/make/jetbrains.mps.make.runtime.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/make/jetbrains.mps.make.script.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/make/jetbrains.mps.make.facet.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.refactoring.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.script.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.textGen.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/text/jetbrains.mps.lang.text.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.slanguage.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/baseLanguage/jetbrains.mps.baseLanguage.regexp.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/make/jetbrains.mps.smodel.resources.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/make/jetbrains.mps.make.facets.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.smodel.query.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.plugin.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.checkedName.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.findUsages.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.typesystem.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/plaf/jetbrains.mps.baseLanguage.search.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.scopes.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.rulesAndMessages.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/baseLanguage/jetbrains.mps.baseLanguage.blTypes.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.intentions.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/baseLanguage/jetbrains.mps.baseLanguage.builders.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/util/jetbrains.mps.project.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/tools/jetbrains.mps.tool.common.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/tools/jetbrains.mps.core.tool.environment.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/baseLanguage/jetbrains.mps.baseLanguage.jdk8.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/util/jetbrains.mps.java.stub.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/make/jetbrains.mps.make.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/plaf/jetbrains.mps.ide.platform.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.access.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.resources.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.messages.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.generator.generationContext.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.util.order.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.generator.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.extension.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.aspect.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.feedback.skeleton.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.feedback.problem.failingRule.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.pattern.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.dataFlow.analyzers.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.dataFlow.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.constraints.rules.skeleton.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.constraints.rules.kinds.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.constraints.rules.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.context.defs.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.context.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.feedback.problem.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.feedback.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/runtimes/jetbrains.mps.lang.feedback.problem.legacy-constraints.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/runtimes/jetbrains.mps.lang.feedback.problem.structure.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.feedback.problem.structural.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.feedback.problem.childAndProp.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.feedback.problem.scopes.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.feedback.messages.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.constraints.msg.specification.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.sharedConcepts.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.constraints.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.project.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.descriptor.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.actions.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/baseLanguage/jetbrains.mps.baseLanguageInternal.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.modelapi.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.baseLanguage.lightweightdsl.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/baseLanguage/jetbrains.mps.baseLanguage.jdk7.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/baseLanguage/jetbrains.mps.baseLanguage.classifiers.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/plaf/jetbrains.mps.baseLanguage.util.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.structure.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.quotation.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/baseLanguage/jetbrains.mps.baseLanguage.scopes.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/baseLanguage/jetbrains.mps.baseLanguage.tuples.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/baseLanguage/jetbrains.mps.baseLanguage.checkedDots.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/baseLanguage/jetbrains.mps.baseLanguage.logging.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/runtimes/jetbrains.mps.refactoring.runtime.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.behavior.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.smodel.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.scopes.runtime.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.migration.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/util/jetbrains.mps.refactoring.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/plaf/jetbrains.mps.ide.refactoring.platform.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.refactoring.participant.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/runtimes/jetbrains.mps.lang.migration.runtime.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/baseLanguage/jetbrains.mps.baseLanguage.collections.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/runtimes/jetbrains.mps.findUsages.runtime.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/runtimes/jetbrains.mps.lang.smodel.query.runtime.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/editor/jetbrains.mps.editorlang.runtime.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/editor/jetbrains.mps.editor.runtime.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.editor.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/xml/jetbrains.mps.core.xml.sax.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/util/jetbrains.mps.kernel.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/util/jetbrains.mps.runtime.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/runtimes/jetbrains.mps.dataFlow.runtime.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.traceable.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/runtimes/jetbrains.mps.lang.behavior.api.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/runtimes/jetbrains.mps.analyzers.runtime.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/baseLanguage/jetbrains.mps.baseLanguage.extensionMethods.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/baseLanguage/jetbrains.mps.baseLanguage.closures.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/baseLanguage/collections.runtime.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.core.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/baseLanguage/jetbrains.mps.baseLanguage.references.runtime.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/baseLanguage/closures.runtime.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/baseLanguage/jetbrains.mps.baseLanguage.javadoc.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/runtimes/jetbrains.mps.lang.feedback.context.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/baseLanguage/jetbrains.mps.baseLanguage.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/languageDesign/jetbrains.mps.lang.generator.generationParameters.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/devkits/jetbrains.mps.devkit.general-purpose.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/devkits/jetbrains.mps.devkit.aspect.constraints.rules.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/devkits/jetbrains.mps.devkit.aspect.constraints.rulesAndMessages.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/devkits/jetbrains.mps.devkit.aspect.constraints.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/devkits/jetbrains.mps.devkit.aspect.typesystem.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/devkits/jetbrains.mps.devkit.aspect.structure.jar\"/>\n- <library file=\"/Users/slisson/mps/mps203/modelix/artifacts/mps/languages/devkits/jetbrains.mps.devkit.templates.jar\"/>\n- <chunk>\n- <module file=\"/Users/slisson/mps/mps203/modelix/generator-test-project/languages/test.org.modelix.generatortestproject.L1/test.org.modelix.generatortestproject.L1.mpl\"/>\n- </chunk>\n- <chunk>\n- <module file=\"/Users/slisson/mps/mps203/modelix/generator-test-project/languages/test.org.modelix.generatortestproject.L2/test.org.modelix.generatortestproject.L2.mpl\"/>\n- </chunk>\n- <chunk>\n- <module file=\"/Users/slisson/mps/mps203/modelix/generator-test-project/solutions/test.org.modelix.generatortestproject.S2/test.org.modelix.generatortestproject.S2.msd\"/>\n- </chunk>\n- <jvmargs>\n- <arg value=\"-ea\"/>\n- <arg value=\"-Xmx1024m\"/>\n- </jvmargs>\n- </generate>\n- </target>\n- <target name=\"declare-mps-tasks\">\n- <taskdef classpathref=\"path.mps.ant.path\" resource=\"jetbrains/mps/build/ant/antlib.xml\"/>\n- </target>\n-</project>\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | New sub-projects for authorization |
426,496 | 03.06.2022 14:12:59 | -7,200 | e2712f6df8810eb9a73e58878f217248d9b2ae7a | Migration to ktor 2.0.2 | [
{
"change_type": "MODIFY",
"old_path": "gitui/build.gradle.kts",
"new_path": "gitui/build.gradle.kts",
"diff": "import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar\n-val ktorVersion = \"1.6.5\"\n+val ktorVersion = \"2.0.2\"\nval kotlinCoroutinesVersion = \"1.5.2\"\n-val kotlinVersion = \"1.5.31\"\n+val kotlinVersion = \"1.6.21\"\nval logbackVersion = \"1.2.1\"\nplugins {\n@@ -23,6 +23,7 @@ tasks.withType<ShadowJar> {\ndependencies {\nimplementation(\"io.ktor\", \"ktor-server-core\", ktorVersion)\n+ implementation(\"io.ktor\", \"ktor-server-cors\", ktorVersion)\nimplementation(\"io.ktor\", \"ktor-server-netty\", ktorVersion)\nimplementation(\"ch.qos.logback\", \"logback-classic\", logbackVersion)\nimplementation(\"org.jetbrains.kotlinx\", \"kotlinx-coroutines-jdk8\", kotlinCoroutinesVersion)\n@@ -37,7 +38,7 @@ dependencies {\nimplementation(project(\":headless-mps\"))\nimplementation(project(\":workspaces\"))\nimplementation(\"org.modelix.mpsbuild:build-tools:1.0.0\")\n- implementation(\"io.ktor\",\"ktor-html-builder\", ktorVersion)\n+ implementation(\"io.ktor\",\"ktor-server-html-builder\", ktorVersion)\nimplementation(\"commons-codec:commons-codec:1.15\")\ntestImplementation(\"org.junit.jupiter:junit-jupiter-api:5.6.0\")\ntestRuntimeOnly(\"org.junit.jupiter:junit-jupiter-engine\")\n"
},
{
"change_type": "MODIFY",
"old_path": "gitui/src/main/kotlin/org/modelix/gitui/Gitui.kt",
"new_path": "gitui/src/main/kotlin/org/modelix/gitui/Gitui.kt",
"diff": "*/\npackage org.modelix.gitui\n-import io.ktor.application.*\n-import io.ktor.html.*\n+import io.ktor.server.application.*\n+import io.ktor.server.html.*\nimport io.ktor.http.*\nimport io.ktor.http.content.*\n-import io.ktor.response.*\n-import io.ktor.routing.*\n+import io.ktor.server.http.content.*\n+import io.ktor.server.response.*\n+import io.ktor.server.routing.*\nimport io.ktor.util.pipeline.*\nimport kotlinx.html.*\nimport java.io.File\n"
},
{
"change_type": "MODIFY",
"old_path": "gitui/src/main/kotlin/org/modelix/gitui/GituiModule.kt",
"new_path": "gitui/src/main/kotlin/org/modelix/gitui/GituiModule.kt",
"diff": "package org.modelix.gitui\n-import io.ktor.application.*\n-import io.ktor.features.*\n+import io.ktor.server.application.*\n+import io.ktor.server.plugins.cors.*\nimport io.ktor.http.*\n-import io.ktor.routing.*\n+import io.ktor.server.routing.*\nimport java.io.File\nfun Application.gituiModule() {\n@@ -31,10 +31,10 @@ fun Application.gituiModule() {\ninstall(CORS) {\nanyHost()\n- header(HttpHeaders.ContentType)\n- method(HttpMethod.Options)\n- method(HttpMethod.Get)\n- method(HttpMethod.Put)\n- method(HttpMethod.Post)\n+ allowHeader(io.ktor.http.HttpHeaders.ContentType)\n+ allowMethod(io.ktor.http.HttpMethod.Options)\n+ allowMethod(io.ktor.http.HttpMethod.Get)\n+ allowMethod(io.ktor.http.HttpMethod.Put)\n+ allowMethod(io.ktor.http.HttpMethod.Post)\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "workspace-manager/build.gradle.kts",
"new_path": "workspace-manager/build.gradle.kts",
"diff": "import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar\ndescription = \"Allows multiple clients to work on the same set of modules from different sources\"\n-val ktorVersion = \"1.6.5\"\n+val ktorVersion = \"2.0.2\"\nval kotlinCoroutinesVersion = \"1.5.2\"\n-val kotlinVersion = \"1.5.31\"\n+val kotlinVersion = \"1.6.21\"\nval logbackVersion = \"1.2.1\"\nplugins {\n@@ -23,7 +23,10 @@ tasks.withType<ShadowJar> {\n}\ndependencies {\n- implementation(\"io.ktor\", \"ktor-server-core\", ktorVersion)\n+ implementation(\"io.ktor:ktor-server-core:$ktorVersion\")\n+ implementation(\"io.ktor:ktor-server-cors:$ktorVersion\")\n+ implementation(\"io.ktor\",\"ktor-server-html-builder\", ktorVersion)\n+ implementation(\"io.ktor:ktor-server-auth:$ktorVersion\")\nimplementation(\"io.ktor\", \"ktor-server-netty\", ktorVersion)\nimplementation(\"ch.qos.logback\", \"logback-classic\", logbackVersion)\nimplementation(\"org.jetbrains.kotlinx\", \"kotlinx-coroutines-jdk8\", kotlinCoroutinesVersion)\n@@ -38,8 +41,8 @@ dependencies {\nimplementation(project(\":headless-mps\"))\nimplementation(project(\":workspaces\"))\nimplementation(project(\":gitui\"))\n+ implementation(project(\":authorization\"))\nimplementation(\"org.modelix.mpsbuild:build-tools:1.0.6\")\n- implementation(\"io.ktor\",\"ktor-html-builder\", ktorVersion)\ntestImplementation(\"org.junit.jupiter:junit-jupiter-api:5.6.0\")\ntestRuntimeOnly(\"org.junit.jupiter:junit-jupiter-engine\")\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "workspace-manager/src/main/kotlin/org/modelix/workspace/manager/WorkspaceManagerModule.kt",
"new_path": "workspace-manager/src/main/kotlin/org/modelix/workspace/manager/WorkspaceManagerModule.kt",
"diff": "package org.modelix.workspace.manager\nimport com.charleskorn.kaml.Yaml\n-import io.ktor.application.*\n-import io.ktor.features.*\n-import io.ktor.html.*\n+import io.ktor.server.application.*\n+import io.ktor.server.html.*\n+import io.ktor.server.plugins.cors.*\nimport io.ktor.http.*\nimport io.ktor.http.content.*\n-import io.ktor.request.*\n-import io.ktor.response.*\n-import io.ktor.routing.*\n+import io.ktor.server.request.*\n+import io.ktor.server.response.*\n+import io.ktor.server.routing.*\n+import kotlinx.html.body\n+import kotlinx.html.style\n+import kotlinx.html.title\nimport kotlinx.html.*\nimport kotlinx.serialization.decodeFromString\nimport kotlinx.serialization.encodeToString\n@@ -669,11 +672,11 @@ fun Application.workspaceManagerModule() {\ninstall(CORS) {\nanyHost()\n- header(HttpHeaders.ContentType)\n- method(HttpMethod.Options)\n- method(HttpMethod.Get)\n- method(HttpMethod.Put)\n- method(HttpMethod.Post)\n+ allowHeader(HttpHeaders.ContentType)\n+ allowMethod(HttpMethod.Options)\n+ allowMethod(HttpMethod.Get)\n+ allowMethod(HttpMethod.Put)\n+ allowMethod(HttpMethod.Post)\n}\n}\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Migration to ktor 2.0.2 |
426,496 | 04.06.2022 09:03:39 | -7,200 | 9cebea3af586fbde4eb7185dea8a35015f83b706 | Authorization for the workspace manager | [
{
"change_type": "MODIFY",
"old_path": "authorization-ui/build.gradle.kts",
"new_path": "authorization-ui/build.gradle.kts",
"diff": "@@ -22,10 +22,11 @@ dependencies {\nimplementation(\"org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.3\")\nimplementation(\"com.charleskorn.kaml:kaml:0.44.0\")\nimplementation(project(\":authorization\"))\n- val ktorVersion = \"1.6.5\"\n+ val ktorVersion = \"2.0.2\"\nimplementation(\"io.ktor\", \"ktor-server-core\", ktorVersion)\n+ implementation(\"io.ktor\", \"ktor-server-cors\", ktorVersion)\nimplementation(\"io.ktor\", \"ktor-server-netty\", ktorVersion)\n- implementation(\"io.ktor\", \"ktor-html-builder\", ktorVersion)\n+ implementation(\"io.ktor\", \"ktor-server-html-builder\", ktorVersion)\nimplementation(\"ch.qos.logback\", \"logback-classic\", \"1.2.1\")\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "authorization-ui/src/main/kotlin/org/modelix/authorization/ui/AuthorizationModule.kt",
"new_path": "authorization-ui/src/main/kotlin/org/modelix/authorization/ui/AuthorizationModule.kt",
"diff": "package org.modelix.authorization.ui\n-import io.ktor.application.*\n-import io.ktor.features.*\n-import io.ktor.html.*\n+import io.ktor.server.application.*\n+import io.ktor.server.plugins.cors.*\n+import io.ktor.server.html.*\nimport io.ktor.http.*\n-import io.ktor.request.*\n-import io.ktor.response.*\n-import io.ktor.routing.*\n+import io.ktor.server.request.*\n+import io.ktor.server.response.*\n+import io.ktor.server.routing.*\nimport kotlinx.html.*\nimport org.modelix.authorization.*\n@@ -148,10 +148,10 @@ fun Application.authorizationModule() {\ninstall(CORS) {\nanyHost()\n- header(HttpHeaders.ContentType)\n- method(HttpMethod.Options)\n- method(HttpMethod.Get)\n- method(HttpMethod.Put)\n- method(HttpMethod.Post)\n+ allowHeader(HttpHeaders.ContentType)\n+ allowMethod(HttpMethod.Options)\n+ allowMethod(HttpMethod.Get)\n+ allowMethod(HttpMethod.Put)\n+ allowMethod(HttpMethod.Post)\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "authorization/build.gradle.kts",
"new_path": "authorization/build.gradle.kts",
"diff": "@@ -8,6 +8,7 @@ plugins {\ndependencies {\nimplementation(\"org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2\")\nimplementation(\"com.charleskorn.kaml:kaml:0.40.0\")\n+ implementation(\"io.ktor:ktor-server-auth:2.0.2\")\nimplementation(project(\":model-client\", configuration = \"jvmRuntimeElements\"))\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "authorization/src/main/kotlin/org/modelix/authorization/AuthenticatedUser.kt",
"new_path": "authorization/src/main/kotlin/org/modelix/authorization/AuthenticatedUser.kt",
"diff": "*/\npackage org.modelix.authorization\n-class AuthenticatedUser(val userId: String, val groups: Set<String>) {\n- fun getUserAndGroupIds(): Sequence<String> = groups.asSequence() + userId\n+import io.ktor.server.auth.*\n+\n+class AuthenticatedUser(val userIds: Set<String>, val groups: Set<String>) : Principal {\n+ fun getUserAndGroupIds(): Sequence<String> = userIds.asSequence() + groups\n+\n+ override fun toString(): String {\n+ val userPart = when (userIds.size) {\n+ 0 -> \"<no user>\"\n+ 1 -> userIds.single()\n+ else -> userIds.joinToString(\"/\")\n+ }\n+ val groupPart = when (groups.size) {\n+ 0 -> \"\"\n+ else -> \" (${groups.joinToString(\", \")})\"\n+ }\n+ return userPart + groupPart\n+ }\n+\n+ companion object {\n+ val PUBLIC_GROUP = \"modelix-public\"\n+ val ANONYMOUS_USER_ID = \"modelix-anonymous\"\n+ val ANONYMOUS_USER = AuthenticatedUser(setOf(ANONYMOUS_USER_ID), setOf(PUBLIC_GROUP))\n+\n+ fun fromHttpHeaders(headers: List<Pair<String, String>>): AuthenticatedUser {\n+ var users = headers.filter { it.first == \"X-Forwarded-Email\" || it.first == \"X-Forwarded-User\" }.map { it.second }\n+ var groups = headers.filter { it.first == \"X-Forwarded-Groups\" }.map { it.second }\n+ if (users.isEmpty()) {\n+ users = listOf(ANONYMOUS_USER_ID)\n+ }\n+ groups += PUBLIC_GROUP\n+ return AuthenticatedUser(users.toSet(), groups.toSet())\n+ }\n+ fun fromHttpHeaders(headers: Iterable<Map.Entry<String, List<String>>>): AuthenticatedUser {\n+ return fromHttpHeaders(headers.flatMap { entry -> entry.value.map { value -> entry.key to value } })\n+ }\n+ fun fromHttpHeaders(headers: Map<String, List<String>>): AuthenticatedUser {\n+ return fromHttpHeaders(headers.entries)\n+ }\n+ }\n}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "authorization/src/main/kotlin/org/modelix/authorization/AuthorizationData.kt",
"new_path": "authorization/src/main/kotlin/org/modelix/authorization/AuthorizationData.kt",
"diff": "@@ -15,7 +15,9 @@ package org.modelix.authorization\n@JvmInline\[email protected]\n-value class PermissionId(val id: String)\n+value class PermissionId(val id: String) {\n+ override fun toString() = id\n+}\[email protected]\ndata class AuthorizationData(\n"
},
{
"change_type": "MODIFY",
"old_path": "authorization/src/main/kotlin/org/modelix/authorization/ModelixAuthorization.kt",
"new_path": "authorization/src/main/kotlin/org/modelix/authorization/ModelixAuthorization.kt",
"diff": "*/\npackage org.modelix.authorization\n+import io.ktor.server.auth.*\nimport kotlinx.serialization.json.Json\nimport org.modelix.model.client.IModelClient\nimport org.modelix.model.client.RestWebModelClient\n@@ -21,15 +22,17 @@ import kotlinx.serialization.encodeToString\nobject ModelixAuthorization {\nprivate val ADMIN_GROUP = \"modelix-administrators\"\n- private val PUBLIC_GROUP = \"modelix-public\"\n- private val ANONYMOUS_USER_ID = \"modelix-anonymous\"\n- private val ANONYMOUS_USER = AuthenticatedUser(ANONYMOUS_USER_ID, setOf(PUBLIC_GROUP))\nvar persistence: IAuthorizationPersistence = ModelServerAuthorizationPersistence()\nfun getData(): AuthorizationData {\nreturn persistence.loadData()\n- ?: AuthorizationData(setOf(ANONYMOUS_USER_ID), setOf(ADMIN_GROUP, PUBLIC_GROUP), emptySet(), emptyList())\n+ ?: AuthorizationData(\n+ setOf(AuthenticatedUser.ANONYMOUS_USER_ID),\n+ setOf(ADMIN_GROUP, AuthenticatedUser.PUBLIC_GROUP),\n+ emptySet(),\n+ emptyList()\n+ )\n}\nfun storeData(data: AuthorizationData) {\n@@ -37,13 +40,29 @@ object ModelixAuthorization {\n}\nfun getPermissions(user: AuthenticatedUser, permissionId: PermissionId): Set<EPermissionType> {\n- val userAndGroupIds = user.getUserAndGroupIds() + PUBLIC_GROUP\n- return getData().grantedPermissions\n+ val userAndGroupIds = user.getUserAndGroupIds() + AuthenticatedUser.PUBLIC_GROUP\n+ val data = getData()\n+ val result = data.grantedPermissions\n.filter { it.permissionId == permissionId && userAndGroupIds.contains(it.userOrGroupId) }\n.map { it.type }.toSet()\n+ if (!data.knownUsers.containsAll(user.userIds) || !data.knownGroups.containsAll(user.groups) || !data.knownPermissions.contains(permissionId)) {\n+ storeData(AuthorizationData(\n+ data.knownUsers + user.userIds,\n+ data.knownGroups + user.groups,\n+ data.knownPermissions + permissionId,\n+ data.grantedPermissions\n+ ))\n+ }\n+ return result\n}\nfun hasPermission(user: AuthenticatedUser, permissionId: PermissionId, type: EPermissionType): Boolean {\nreturn getPermissions(user, permissionId).any { it.includes(type) }\n}\n+\n+ fun checkPermission(user: AuthenticatedUser, permissionId: PermissionId, type: EPermissionType) {\n+ if (!hasPermission(user, permissionId, type)) {\n+ throw NoPermissionException(user, permissionId, type)\n+ }\n+ }\n}\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "authorization/src/main/kotlin/org/modelix/authorization/NoPermissionException.kt",
"diff": "+/*\n+ * Copyright 2003-2022 JetBrains s.r.o.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.modelix.authorization\n+\n+class NoPermissionException(val user: AuthenticatedUser, val permissionId: PermissionId, val type: EPermissionType)\n+ : RuntimeException(\"$user has no $type permission on '$permissionId'\")\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "authorization/src/main/kotlin/org/modelix/authorization/ktor/OAuthProxyAuth.kt",
"diff": "+/*\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.modelix.authorization.ktor\n+\n+import io.ktor.server.auth.*\n+import org.modelix.authorization.AuthenticatedUser\n+\n+class OAuthProxyAuth(authenticationConfig: Config) : AuthenticationProvider(authenticationConfig) {\n+ override suspend fun onAuthenticate(context: AuthenticationContext) {\n+ val pricipal = AuthenticatedUser.fromHttpHeaders(context.call.request.headers.entries())\n+ context.principal(pricipal)\n+ }\n+ public class Config internal constructor(name: String?) : AuthenticationProvider.Config(name) {\n+\n+ }\n+}\n+\n+public fun AuthenticationConfig.oauthProxy(\n+ name: String? = null,\n+ configure: OAuthProxyAuth.Config.() -> Unit\n+) {\n+ val provider = OAuthProxyAuth(OAuthProxyAuth.Config(name).apply(configure))\n+ register(provider)\n+}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "workspace-manager/build.gradle.kts",
"new_path": "workspace-manager/build.gradle.kts",
"diff": "@@ -27,6 +27,7 @@ dependencies {\nimplementation(\"io.ktor:ktor-server-cors:$ktorVersion\")\nimplementation(\"io.ktor\",\"ktor-server-html-builder\", ktorVersion)\nimplementation(\"io.ktor:ktor-server-auth:$ktorVersion\")\n+ implementation(\"io.ktor:ktor-server-status-pages:$ktorVersion\")\nimplementation(\"io.ktor\", \"ktor-server-netty\", ktorVersion)\nimplementation(\"ch.qos.logback\", \"logback-classic\", logbackVersion)\nimplementation(\"org.jetbrains.kotlinx\", \"kotlinx-coroutines-jdk8\", kotlinCoroutinesVersion)\n"
},
{
"change_type": "MODIFY",
"old_path": "workspace-manager/src/main/kotlin/org/modelix/workspace/manager/WorkspaceManagerModule.kt",
"new_path": "workspace-manager/src/main/kotlin/org/modelix/workspace/manager/WorkspaceManagerModule.kt",
"diff": "@@ -20,6 +20,8 @@ import io.ktor.server.html.*\nimport io.ktor.server.plugins.cors.*\nimport io.ktor.http.*\nimport io.ktor.http.content.*\n+import io.ktor.server.auth.*\n+import io.ktor.server.plugins.statuspages.*\nimport io.ktor.server.request.*\nimport io.ktor.server.response.*\nimport io.ktor.server.routing.*\n@@ -31,6 +33,8 @@ import kotlinx.serialization.decodeFromString\nimport kotlinx.serialization.encodeToString\nimport org.apache.commons.io.FileUtils\nimport org.apache.commons.text.StringEscapeUtils\n+import org.modelix.authorization.*\n+import org.modelix.authorization.ktor.oauthProxy\nimport org.modelix.gitui.GIT_REPO_DIR_ATTRIBUTE_KEY\nimport org.modelix.gitui.MPS_INSTANCE_URL_ATTRIBUTE_KEY\nimport org.modelix.gitui.gitui\n@@ -44,8 +48,24 @@ fun Application.workspaceManagerModule() {\nval manager = WorkspaceManager()\ninstall(Routing)\n+ install(Authentication) {\n+ oauthProxy(\"oauth-proxy\") { }\n+ }\n+ install(StatusPages) {\n+ exception<Throwable> { call, cause ->\n+ when (cause) {\n+ is NoPermissionException -> call.respondText(text = cause.message ?: \"\" , status = HttpStatusCode.Unauthorized)\n+ else -> call.respondText(text = \"500: $cause\" , status = HttpStatusCode.InternalServerError)\n+ }\n+ }\n+ }\nrouting {\n+ authenticate(\"oauth-proxy\") {\n+ intercept(ApplicationCallPipeline.Call) {\n+ ModelixAuthorization.checkPermission(call.principal<AuthenticatedUser>()!!, PermissionId(\"workspaces\"), EPermissionType.READ)\n+ }\n+\nget(\"/\") {\ncall.respondHtml(HttpStatusCode.OK) {\nhead {\n@@ -145,6 +165,8 @@ fun Application.workspaceManagerModule() {\n}\npost(\"{workspaceId}/update\") {\n+ call.requiresWrite()\n+\nval yamlText = call.receiveParameters()[\"content\"]\nval id = call.parameters[\"workspaceId\"] ?: throw IllegalArgumentException(\"workspaceId missing\")\nif (yamlText == null) {\n@@ -164,10 +186,6 @@ fun Application.workspaceManagerModule() {\ncall.respondRedirect(\"./edit\")\n}\n- get(\"/health\") {\n- call.respondText(\"healthy\", ContentType.Text.Plain, HttpStatusCode.OK)\n- }\n-\nget(\"{workspaceId}/edit\") {\nval id = call.parameters[\"workspaceId\"]\nif (id == null) {\n@@ -550,6 +568,7 @@ fun Application.workspaceManagerModule() {\n}\npost(\"{workspaceId}/upload\") {\n+ call.requiresWrite()\nval workspaceId = call.parameters[\"workspaceId\"]!!\nval workspaceAndHash = manager.getWorkspaceForId(workspaceId)\nif (workspaceAndHash == null) {\n@@ -582,6 +601,7 @@ fun Application.workspaceManagerModule() {\n}\npost(\"{workspaceId}/use-upload\") {\n+ call.requiresWrite()\nval workspaceId = call.parameters[\"workspaceId\"]!!\nval uploadId = call.receiveParameters()[\"uploadId\"]!!\nval workspace = manager.getWorkspaceForId(workspaceId)?.first!!\n@@ -591,6 +611,7 @@ fun Application.workspaceManagerModule() {\n}\npost(\"{workspaceId}/remove-upload\") {\n+ call.requiresWrite()\nval workspaceId = call.parameters[\"workspaceId\"]!!\nval uploadId = call.receiveParameters()[\"uploadId\"]!!\nval workspace = manager.getWorkspaceForId(workspaceId)?.first!!\n@@ -600,6 +621,7 @@ fun Application.workspaceManagerModule() {\n}\npost(\"{workspaceId}/delete-upload\") {\n+ call.requiresWrite()\nval uploadId = call.receiveParameters()[\"uploadId\"]!!\nval allWorkspaces = manager.getWorkspaceIds().mapNotNull { manager.getWorkspaceForId(it)?.first }\nfor (workspace in allWorkspaces.filter { it.uploads.contains(uploadId) }) {\n@@ -611,6 +633,7 @@ fun Application.workspaceManagerModule() {\n}\npost(\"remove-workspace\") {\n+ call.requiresWrite()\nval workspaceId = call.receiveParameters()[\"workspaceId\"]!!\nmanager.removeWorkspace(workspaceId)\ncall.respondRedirect(\".\")\n@@ -670,6 +693,12 @@ fun Application.workspaceManagerModule() {\n}\n}\n+ get(\"/health\") {\n+ call.respondText(\"healthy\", ContentType.Text.Plain, HttpStatusCode.OK)\n+ }\n+\n+ }\n+\ninstall(CORS) {\nanyHost()\nallowHeader(HttpHeaders.ContentType)\n@@ -690,3 +719,7 @@ private fun findGitRepo(folder: File): File? {\n}\nreturn null\n}\n+\n+private fun ApplicationCall.requiresWrite() {\n+ ModelixAuthorization.checkPermission(principal<AuthenticatedUser>()!!, PermissionId(\"workspaces\"), EPermissionType.WRITE)\n+}\n\\ No newline at end of file\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Authorization for the workspace manager |
426,496 | 07.06.2022 10:21:45 | -7,200 | 84a3dff2c71bdf7ab993640a02f121a09f0d3068 | Remove button for permissions | [
{
"change_type": "MODIFY",
"old_path": "authorization-ui/src/main/kotlin/org/modelix/authorization/ui/AuthorizationModule.kt",
"new_path": "authorization-ui/src/main/kotlin/org/modelix/authorization/ui/AuthorizationModule.kt",
"diff": "@@ -100,6 +100,14 @@ fun Application.authorizationModule() {\ntd { +grantedPermission.userOrGroupId }\ntd { +grantedPermission.type.name }\ntd { +grantedPermission.permissionId.id }\n+ td {\n+ form(action = \"removeGrantedPermission\", method = FormMethod.post) {\n+ hiddenInput(name = \"userOrGroupId\") { value = grantedPermission.userOrGroupId }\n+ hiddenInput(name = \"type\") { value = grantedPermission.type.name }\n+ hiddenInput(name = \"permission\") { value = grantedPermission.permissionId.id }\n+ submitInput { value = \"Remove\" }\n+ }\n+ }\n}\n}\n}\n@@ -144,6 +152,23 @@ fun Application.authorizationModule() {\nModelixAuthorization.storeData(data)\ncall.respondRedirect(\".\")\n}\n+\n+ post(\"removeGrantedPermission\") {\n+ val params = call.receiveParameters()\n+ ModelixAuthorization.updateData { data ->\n+ AuthorizationData(\n+ data.knownUsers,\n+ data.knownGroups,\n+ data.knownPermissions,\n+ data.grantedPermissions.filterNot {\n+ it.userOrGroupId == params[\"userOrGroupId\"] &&\n+ it.type.name == params[\"type\"] &&\n+ it.permissionId.id == params[\"permission\"]\n+ }\n+ )\n+ }\n+ call.respondRedirect(\".\")\n+ }\n}\ninstall(CORS) {\n"
},
{
"change_type": "MODIFY",
"old_path": "authorization/src/main/kotlin/org/modelix/authorization/ModelixAuthorization.kt",
"new_path": "authorization/src/main/kotlin/org/modelix/authorization/ModelixAuthorization.kt",
"diff": "*/\npackage org.modelix.authorization\n-import io.ktor.server.auth.*\n-import kotlinx.serialization.json.Json\n-import org.modelix.model.client.IModelClient\n-import org.modelix.model.client.RestWebModelClient\n-import kotlinx.serialization.decodeFromString\n-import kotlinx.serialization.encodeToString\n-\nobject ModelixAuthorization {\nprivate val ADMIN_GROUP = \"modelix-administrators\"\n@@ -35,6 +28,10 @@ object ModelixAuthorization {\n)\n}\n+ fun updateData(body: (AuthorizationData)->AuthorizationData) {\n+ storeData(body(getData()))\n+ }\n+\nfun storeData(data: AuthorizationData) {\npersistence.storeData(data)\n}\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Remove button for permissions |
426,496 | 07.06.2022 11:17:38 | -7,200 | 5c38fac329c29a669b59f69e79dfd3aff4ec4a7c | Button for granting permissions | [
{
"change_type": "MODIFY",
"old_path": "authorization-ui/src/main/kotlin/org/modelix/authorization/ui/AuthorizationModule.kt",
"new_path": "authorization-ui/src/main/kotlin/org/modelix/authorization/ui/AuthorizationModule.kt",
"diff": "@@ -34,20 +34,22 @@ fun Application.authorizationModule() {\ncall.respondHtml {\nbody {\nform(action = \"update\", method = FormMethod.post) {\n+ }\nh1 { +\"Known Users\" }\ntable {\nfor (userId in data.knownUsers) {\ntr {\ntd {\n- checkBoxInput(name = \"user\") { value = userId }\n+userId\n}\n}\n}\ntr {\ntd {\n+ form(action = \"add-user\", method = FormMethod.post) {\ntextInput(name = \"new-user-id\")\n- submitInput(name = \"add-user\") { value = \"+\" }\n+ submitInput { value = \"+\" }\n+ }\n}\n}\n}\n@@ -56,15 +58,16 @@ fun Application.authorizationModule() {\nfor (groupId in data.knownGroups) {\ntr {\ntd {\n- checkBoxInput(name = \"group\") { value = groupId }\n+groupId\n}\n}\n}\ntr {\ntd {\n+ form(action = \"add-group\", method = FormMethod.post) {\ntextInput(name = \"new-group-id\")\n- submitInput(name = \"add-group\") { value = \"+\" }\n+ submitInput { value = \"+\" }\n+ }\n}\n}\n}\n@@ -73,24 +76,17 @@ fun Application.authorizationModule() {\nfor (permissionId in data.getAllKnownPermissions().sortedBy { it.id }) {\ntr {\ntd {\n- checkBoxInput(name = \"permission\") { value = permissionId.id }\n+permissionId.id\n}\n}\n}\ntr {\ntd {\n+ form(action = \"add-permission\", method = FormMethod.post) {\ntextInput(name = \"new-permission-id\")\n- submitInput(name = \"add-permission\") { value = \"+\" }\n- }\n+ submitInput { value = \"+\" }\n}\n}\n- div {\n- +\"Grant \"\n- for (type in EPermissionType.values()) {\n- submitInput(name = \"type\") { value = type.name }\n- }\n- +\" access\"\n}\n}\nh1 { +\"Granted Permissions\" }\n@@ -110,47 +106,56 @@ fun Application.authorizationModule() {\n}\n}\n}\n+ tr {\n+ td {\n+ select {\n+ name = \"userOrGroupId\"\n+ form = \"grantPermissionForm\"\n+ multiple = true\n+ for (userOrGroup in data.knownUsers + data.knownGroups) {\n+ option {\n+ value = userOrGroup\n+ +userOrGroup\n+ }\n+ }\n}\n}\n+ td {\n+ select {\n+ name = \"type\"\n+ form = \"grantPermissionForm\"\n+ multiple = true\n+ for (type in EPermissionType.values()) {\n+ option {\n+ value = type.name\n+ +type.name\n}\n}\n-\n- post(\"update\") {\n- val params: Parameters = call.receiveParameters()\n- var data = ModelixAuthorization.getData()\n- if (params.contains(\"type\")) {\n- val users = params.getAll(\"user\") ?: emptyList()\n- val groups = params.getAll(\"group\") ?: emptyList()\n- val permissions = params.getAll(\"permission\")?.map { PermissionId(it) } ?: emptyList()\n- val type = params[\"type\"]?.let { EPermissionType.valueOf(it) }\n- if (type != null) {\n- for (permission in permissions) {\n- for (user in users) {\n- data = data.withGrantedPermission(PermissionData(user, permission, type))\n}\n- for (group in groups) {\n- data = data.withGrantedPermission(PermissionData(group, permission, type))\n}\n+ td {\n+ select {\n+ name = \"permission\"\n+ form = \"grantPermissionForm\"\n+ multiple = true\n+ for (permission in data.knownPermissions) {\n+ option {\n+ value = permission.id\n+ +permission.id\n+ }\n+ }\n+ }\n+ }\n+ td {\n+ form(action = \"grantPermission\", method = FormMethod.post) {\n+ id = \"grantPermissionForm\"\n+ submitInput { value = \"+\" }\n}\n}\n- } else if (params.contains(\"add-user\")) {\n- val id = params[\"new-user-id\"]\n- if (id != null) {\n- data = data.withUser(id)\n}\n- } else if (params.contains(\"add-group\")) {\n- val id = params[\"new-group-id\"]\n- if (id != null) {\n- data = data.withGroup(id)\n}\n- } else if (params.contains(\"add-permission\")) {\n- val id = params[\"new-permission-id\"]\n- if (id != null) {\n- data = data.withPermission(PermissionId(id))\n}\n}\n- ModelixAuthorization.storeData(data)\n- call.respondRedirect(\".\")\n}\npost(\"removeGrantedPermission\") {\n@@ -169,6 +174,66 @@ fun Application.authorizationModule() {\n}\ncall.respondRedirect(\".\")\n}\n+\n+ post(\"grantPermission\") {\n+ val params = call.receiveParameters()\n+ ModelixAuthorization.updateData { data ->\n+ var newPermissions = data.grantedPermissions\n+ for (userOrGroupId in params.getAll(\"userOrGroupId\")!!) {\n+ for (type in params.getAll(\"type\")!!) {\n+ for (permission in params.getAll(\"permission\")!!) {\n+ newPermissions += PermissionData(userOrGroupId, PermissionId(permission), EPermissionType.valueOf(type))\n+ }\n+ }\n+ }\n+ AuthorizationData(\n+ data.knownUsers,\n+ data.knownGroups,\n+ data.knownPermissions,\n+ newPermissions.distinct()\n+ )\n+ }\n+ call.respondRedirect(\".\")\n+ }\n+\n+ post(\"add-user\") {\n+ val params = call.receiveParameters()\n+ ModelixAuthorization.updateData { data ->\n+ AuthorizationData(\n+ data.knownUsers + params[\"new-user-id\"]!!,\n+ data.knownGroups,\n+ data.knownPermissions,\n+ data.grantedPermissions\n+ )\n+ }\n+ call.respondRedirect(\".\")\n+ }\n+\n+ post(\"add-group\") {\n+ val params = call.receiveParameters()\n+ ModelixAuthorization.updateData { data ->\n+ AuthorizationData(\n+ data.knownUsers,\n+ data.knownGroups + params[\"new-group-id\"]!!,\n+ data.knownPermissions,\n+ data.grantedPermissions\n+ )\n+ }\n+ call.respondRedirect(\".\")\n+ }\n+\n+ post(\"add-permission\") {\n+ val params = call.receiveParameters()\n+ ModelixAuthorization.updateData { data ->\n+ AuthorizationData(\n+ data.knownUsers,\n+ data.knownGroups,\n+ data.knownPermissions + PermissionId(params[\"new-permission-id\"]!!),\n+ data.grantedPermissions\n+ )\n+ }\n+ call.respondRedirect(\".\")\n+ }\n}\ninstall(CORS) {\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Button for granting permissions |
426,496 | 07.06.2022 13:01:06 | -7,200 | c30fcd35dba7d52ec01555781c6c48e16de4c8bf | Check permissions for changing permissions | [
{
"change_type": "MODIFY",
"old_path": "authorization-ui/build.gradle.kts",
"new_path": "authorization-ui/build.gradle.kts",
"diff": "@@ -27,6 +27,8 @@ dependencies {\nimplementation(\"io.ktor\", \"ktor-server-cors\", ktorVersion)\nimplementation(\"io.ktor\", \"ktor-server-netty\", ktorVersion)\nimplementation(\"io.ktor\", \"ktor-server-html-builder\", ktorVersion)\n+ implementation(\"io.ktor:ktor-server-auth:$ktorVersion\")\n+ implementation(\"io.ktor:ktor-server-status-pages:$ktorVersion\")\nimplementation(\"ch.qos.logback\", \"logback-classic\", \"1.2.1\")\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "authorization-ui/src/main/kotlin/org/modelix/authorization/ui/AuthorizationModule.kt",
"new_path": "authorization-ui/src/main/kotlin/org/modelix/authorization/ui/AuthorizationModule.kt",
"diff": "@@ -18,17 +18,24 @@ import io.ktor.server.application.*\nimport io.ktor.server.plugins.cors.*\nimport io.ktor.server.html.*\nimport io.ktor.http.*\n+import io.ktor.server.auth.*\n+import io.ktor.server.plugins.statuspages.*\nimport io.ktor.server.request.*\nimport io.ktor.server.response.*\nimport io.ktor.server.routing.*\nimport kotlinx.html.*\nimport org.modelix.authorization.*\n+import org.modelix.authorization.ktor.installAuthentication\n+import org.modelix.authorization.ktor.oauthProxy\n+import org.modelix.authorization.ktor.requiresPermission\nfun Application.authorizationModule() {\ninstall(Routing)\n+ installAuthentication()\nrouting {\n+ requiresPermission(ModelixAuthorization.AUTHORIZATION_DATA_PERMISSION, EPermissionType.READ) {\nget(\"/\") {\nval data = ModelixAuthorization.getData()\ncall.respondHtml {\n@@ -157,7 +164,8 @@ fun Application.authorizationModule() {\n}\n}\n}\n-\n+ }\n+ requiresPermission(ModelixAuthorization.AUTHORIZATION_DATA_PERMISSION, EPermissionType.WRITE) {\npost(\"removeGrantedPermission\") {\nval params = call.receiveParameters()\nModelixAuthorization.updateData { data ->\n@@ -235,6 +243,7 @@ fun Application.authorizationModule() {\ncall.respondRedirect(\".\")\n}\n}\n+ }\ninstall(CORS) {\nanyHost()\n"
},
{
"change_type": "MODIFY",
"old_path": "authorization/build.gradle.kts",
"new_path": "authorization/build.gradle.kts",
"diff": "@@ -8,7 +8,9 @@ plugins {\ndependencies {\nimplementation(\"org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2\")\nimplementation(\"com.charleskorn.kaml:kaml:0.40.0\")\n- implementation(\"io.ktor:ktor-server-auth:2.0.2\")\n+ val ktorVersion = \"2.0.2\"\n+ implementation(\"io.ktor:ktor-server-auth:$ktorVersion\")\n+ implementation(\"io.ktor:ktor-server-status-pages:$ktorVersion\")\nimplementation(project(\":model-client\", configuration = \"jvmRuntimeElements\"))\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "authorization/src/main/kotlin/org/modelix/authorization/ModelixAuthorization.kt",
"new_path": "authorization/src/main/kotlin/org/modelix/authorization/ModelixAuthorization.kt",
"diff": "@@ -15,6 +15,7 @@ package org.modelix.authorization\nobject ModelixAuthorization {\nprivate val ADMIN_GROUP = \"modelix-administrators\"\n+ val AUTHORIZATION_DATA_PERMISSION = PermissionId(\"authorization-data\")\nvar persistence: IAuthorizationPersistence = ModelServerAuthorizationPersistence()\n@@ -54,7 +55,14 @@ object ModelixAuthorization {\n}\nfun hasPermission(user: AuthenticatedUser, permissionId: PermissionId, type: EPermissionType): Boolean {\n- return getPermissions(user, permissionId).any { it.includes(type) }\n+ val result = getPermissions(user, permissionId).any { it.includes(type) }\n+ if (permissionId == AUTHORIZATION_DATA_PERMISSION && !result) {\n+ if (!getData().grantedPermissions.any { it.permissionId == permissionId && it.type.includes(EPermissionType.WRITE) }) {\n+ // if nobody has the permission to edit permissions we would have a problem\n+ return true\n+ }\n+ }\n+ return result\n}\nfun checkPermission(user: AuthenticatedUser, permissionId: PermissionId, type: EPermissionType) {\n"
},
{
"change_type": "RENAME",
"old_path": "authorization/src/main/kotlin/org/modelix/authorization/ktor/OAuthProxyAuth.kt",
"new_path": "authorization/src/main/kotlin/org/modelix/authorization/ktor/KtorAuthUtils.kt",
"diff": "*/\npackage org.modelix.authorization.ktor\n+import io.ktor.http.*\n+import io.ktor.server.application.*\nimport io.ktor.server.auth.*\n-import org.modelix.authorization.AuthenticatedUser\n+import io.ktor.server.plugins.statuspages.*\n+import io.ktor.server.response.*\n+import io.ktor.server.routing.*\n+import org.modelix.authorization.*\nclass OAuthProxyAuth(authenticationConfig: Config) : AuthenticationProvider(authenticationConfig) {\noverride suspend fun onAuthenticate(context: AuthenticationContext) {\n@@ -33,3 +38,34 @@ public fun AuthenticationConfig.oauthProxy(\nval provider = OAuthProxyAuth(OAuthProxyAuth.Config(name).apply(configure))\nregister(provider)\n}\n+\n+\n+fun Application.installAuthentication() {\n+ install(Authentication) {\n+ oauthProxy(\"oauth-proxy\") { }\n+ }\n+ install(StatusPages) {\n+ exception<Throwable> { call, cause ->\n+ when (cause) {\n+ is NoPermissionException -> call.respondText(\n+ text = cause.message ?: \"\",\n+ status = io.ktor.http.HttpStatusCode.Unauthorized\n+ )\n+ else -> call.respondText(text = \"500: $cause\", status = io.ktor.http.HttpStatusCode.InternalServerError)\n+ }\n+ }\n+ }\n+}\n+\n+fun Route.requiresPermission(permission: PermissionId, type: EPermissionType, body: Route.()->Unit) {\n+ authenticate(\"oauth-proxy\") {\n+ intercept(ApplicationCallPipeline.Call) {\n+ ModelixAuthorization.checkPermission(\n+ call.principal<AuthenticatedUser>()!!,\n+ ModelixAuthorization.AUTHORIZATION_DATA_PERMISSION,\n+ type\n+ )\n+ }\n+ body()\n+ }\n+}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "workspace-manager/src/main/kotlin/org/modelix/workspace/manager/WorkspaceManagerModule.kt",
"new_path": "workspace-manager/src/main/kotlin/org/modelix/workspace/manager/WorkspaceManagerModule.kt",
"diff": "@@ -34,7 +34,9 @@ import kotlinx.serialization.encodeToString\nimport org.apache.commons.io.FileUtils\nimport org.apache.commons.text.StringEscapeUtils\nimport org.modelix.authorization.*\n+import org.modelix.authorization.ktor.installAuthentication\nimport org.modelix.authorization.ktor.oauthProxy\n+import org.modelix.authorization.ktor.requiresPermission\nimport org.modelix.gitui.GIT_REPO_DIR_ATTRIBUTE_KEY\nimport org.modelix.gitui.MPS_INSTANCE_URL_ATTRIBUTE_KEY\nimport org.modelix.gitui.gitui\n@@ -48,24 +50,10 @@ fun Application.workspaceManagerModule() {\nval manager = WorkspaceManager()\ninstall(Routing)\n- install(Authentication) {\n- oauthProxy(\"oauth-proxy\") { }\n- }\n- install(StatusPages) {\n- exception<Throwable> { call, cause ->\n- when (cause) {\n- is NoPermissionException -> call.respondText(text = cause.message ?: \"\" , status = HttpStatusCode.Unauthorized)\n- else -> call.respondText(text = \"500: $cause\" , status = HttpStatusCode.InternalServerError)\n- }\n- }\n- }\n+ installAuthentication()\nrouting {\n- authenticate(\"oauth-proxy\") {\n- intercept(ApplicationCallPipeline.Call) {\n- ModelixAuthorization.checkPermission(call.principal<AuthenticatedUser>()!!, PermissionId(\"workspaces\"), EPermissionType.READ)\n- }\n-\n+ requiresPermission(PermissionId(\"workspaces\"), EPermissionType.READ) {\nget(\"/\") {\ncall.respondHtml(HttpStatusCode.OK) {\nhead {\n@@ -567,6 +555,61 @@ fun Application.workspaceManagerModule() {\n}\n}\n+ route(\"{workspaceId}/git/{repoOrUploadIndex}/\") {\n+ intercept(ApplicationCallPipeline.Call) {\n+ val workspaceId = call.parameters[\"workspaceId\"]!!\n+ val repoOrUploadIndex = call.parameters[\"repoOrUploadIndex\"]!!\n+ var repoIndex: Int? = null\n+ var uploadId: String? = null\n+ if (repoOrUploadIndex.startsWith(\"u\")) {\n+ uploadId = repoOrUploadIndex.drop(1)\n+ } else {\n+ repoIndex = repoOrUploadIndex.toInt()\n+ }\n+ val workspaceAndHash = manager.getWorkspaceForId(workspaceId)\n+ if (workspaceAndHash == null) {\n+ call.respondText(\"Workspace $workspaceId not found\", ContentType.Text.Plain, HttpStatusCode.NotFound)\n+ return@intercept\n+ }\n+ val (workspace, workspaceHash) = workspaceAndHash\n+ val repoDir: File\n+ if (repoIndex != null) {\n+ val repos = workspace.gitRepositories\n+ if (!repos.indices.contains(repoIndex)) {\n+ call.respondText(\"Git repository with index $repoIndex doesn't exist\", ContentType.Text.Plain, HttpStatusCode.NotFound)\n+ return@intercept\n+ }\n+ val repo = repos[repoIndex]\n+ val repoManager = GitRepositoryManager(repo, manager.getWorkspaceDirectory(workspace))\n+ if (!repoManager.repoDirectory.exists()) {\n+ repoManager.updateRepo()\n+ }\n+ repoDir = repoManager.repoDirectory\n+ } else {\n+ val uploadFolder = manager.getUploadFolder(uploadId!!)\n+ if (!uploadFolder.exists()) {\n+ call.respondText(\"Upload $uploadId doesn't exist\", ContentType.Text.Plain, HttpStatusCode.NotFound)\n+ return@intercept\n+ }\n+ if (uploadFolder.resolve(\".git\").exists()) {\n+ repoDir = uploadFolder\n+ } else {\n+ val repoDirFromUpload = findGitRepo(uploadFolder)\n+ if (repoDirFromUpload == null) {\n+ call.respondText(\"No git repository found in upload $uploadId\", ContentType.Text.Plain, HttpStatusCode.NotFound)\n+ return@intercept\n+ }\n+ repoDir = repoDirFromUpload\n+ }\n+ }\n+ call.attributes.put(GIT_REPO_DIR_ATTRIBUTE_KEY, repoDir)\n+ call.attributes.put(MPS_INSTANCE_URL_ATTRIBUTE_KEY, \"../../../../workspace-${workspace.id}-$workspaceHash/\")\n+ }\n+ gitui()\n+ }\n+ }\n+\n+ requiresPermission(PermissionId(\"workspaces\"), EPermissionType.WRITE) {\npost(\"{workspaceId}/upload\") {\ncall.requiresWrite()\nval workspaceId = call.parameters[\"workspaceId\"]!!\n@@ -638,59 +681,6 @@ fun Application.workspaceManagerModule() {\nmanager.removeWorkspace(workspaceId)\ncall.respondRedirect(\".\")\n}\n-\n- route(\"{workspaceId}/git/{repoOrUploadIndex}/\") {\n- intercept(ApplicationCallPipeline.Call) {\n- val workspaceId = call.parameters[\"workspaceId\"]!!\n- val repoOrUploadIndex = call.parameters[\"repoOrUploadIndex\"]!!\n- var repoIndex: Int? = null\n- var uploadId: String? = null\n- if (repoOrUploadIndex.startsWith(\"u\")) {\n- uploadId = repoOrUploadIndex.drop(1)\n- } else {\n- repoIndex = repoOrUploadIndex.toInt()\n- }\n- val workspaceAndHash = manager.getWorkspaceForId(workspaceId)\n- if (workspaceAndHash == null) {\n- call.respondText(\"Workspace $workspaceId not found\", ContentType.Text.Plain, HttpStatusCode.NotFound)\n- return@intercept\n- }\n- val (workspace, workspaceHash) = workspaceAndHash\n- val repoDir: File\n- if (repoIndex != null) {\n- val repos = workspace.gitRepositories\n- if (!repos.indices.contains(repoIndex)) {\n- call.respondText(\"Git repository with index $repoIndex doesn't exist\", ContentType.Text.Plain, HttpStatusCode.NotFound)\n- return@intercept\n- }\n- val repo = repos[repoIndex]\n- val repoManager = GitRepositoryManager(repo, manager.getWorkspaceDirectory(workspace))\n- if (!repoManager.repoDirectory.exists()) {\n- repoManager.updateRepo()\n- }\n- repoDir = repoManager.repoDirectory\n- } else {\n- val uploadFolder = manager.getUploadFolder(uploadId!!)\n- if (!uploadFolder.exists()) {\n- call.respondText(\"Upload $uploadId doesn't exist\", ContentType.Text.Plain, HttpStatusCode.NotFound)\n- return@intercept\n- }\n- if (uploadFolder.resolve(\".git\").exists()) {\n- repoDir = uploadFolder\n- } else {\n- val repoDirFromUpload = findGitRepo(uploadFolder)\n- if (repoDirFromUpload == null) {\n- call.respondText(\"No git repository found in upload $uploadId\", ContentType.Text.Plain, HttpStatusCode.NotFound)\n- return@intercept\n- }\n- repoDir = repoDirFromUpload\n- }\n- }\n- call.attributes.put(GIT_REPO_DIR_ATTRIBUTE_KEY, repoDir)\n- call.attributes.put(MPS_INSTANCE_URL_ATTRIBUTE_KEY, \"../../../../workspace-${workspace.id}-$workspaceHash/\")\n- }\n- gitui()\n- }\n}\nget(\"/health\") {\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Check permissions for changing permissions |
426,496 | 08.06.2022 09:27:03 | -7,200 | cbc7eebe712e2bfeefc551cf88669cc8e93966cb | model server history migrated | [
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/java/org/modelix/model/server/Main.kt",
"new_path": "model-server/src/main/java/org/modelix/model/server/Main.kt",
"diff": "@@ -238,10 +238,11 @@ object Main {\nFileUtils.readFileToString(sharedSecretFile, StandardCharsets.UTF_8)\n)\n}\n- // TODO handlerList.addHandler(HistoryHandler(localModelClient))\n- val ktorServer: NettyApplicationEngine = embeddedServer(Netty, port = 28101) {\n+ val historyHandler = HistoryHandler(localModelClient)\n+ val ktorServer: NettyApplicationEngine = embeddedServer(Netty, port = DEFAULT_PORT) {\nmodelServer.init(this)\n+ historyHandler.init(this)\n}\nktorServer.start()\nLOG.info(\"Server started\")\n"
},
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/kotlin/org/modelix/model/server/HistoryHandler.kt",
"new_path": "model-server/src/main/kotlin/org/modelix/model/server/HistoryHandler.kt",
"diff": "package org.modelix.model.server\n+import io.ktor.http.*\n+import io.ktor.server.application.*\n+import io.ktor.server.auth.*\n+import io.ktor.server.request.*\n+import io.ktor.server.response.*\n+import io.ktor.server.routing.*\nimport org.apache.commons.lang3.StringEscapeUtils\n-import org.eclipse.jetty.server.Request\n-import org.eclipse.jetty.server.handler.AbstractHandler\n-import org.modelix.model.persistent.CPVersion.Companion.DESERIALIZER\n-import org.modelix.model.operations.applyOperation\n-import org.modelix.model.lazy.CLVersion.Companion.createRegularVersion\n+import org.modelix.authorization.AuthenticatedUser\n+import org.modelix.model.LinearHistory\n+import org.modelix.model.api.*\nimport org.modelix.model.client.IModelClient\n-import java.io.IOException\n-import javax.servlet.ServletException\n-import javax.servlet.http.HttpServletRequest\n-import javax.servlet.http.HttpServletResponse\n+import org.modelix.model.lazy.CLTree\nimport org.modelix.model.lazy.CLVersion\n-import org.modelix.model.operations.OTBranch\n-import org.modelix.model.operations.RevertToOp\n+import org.modelix.model.lazy.CLVersion.Companion.createRegularVersion\nimport org.modelix.model.lazy.KVEntryReference\n-import org.modelix.model.lazy.CLTree\nimport org.modelix.model.lazy.RepositoryId\nimport org.modelix.model.metameta.MetaModelBranch\n+import org.modelix.model.operations.OTBranch\n+import org.modelix.model.operations.RevertToOp\n+import org.modelix.model.operations.applyOperation\n+import org.modelix.model.persistent.CPVersion.Companion.DESERIALIZER\nimport java.io.PrintWriter\n-import java.lang.Runnable\n-import org.modelix.model.LinearHistory\n-import org.modelix.model.api.*\nimport java.net.URLEncoder\n-import java.lang.NumberFormatException\nimport java.nio.charset.StandardCharsets\nimport java.time.LocalDateTime\nimport java.time.format.DateTimeFormatter\n-import java.util.*\n-import java.util.stream.Collectors\n-class HistoryHandler(private val client: IModelClient) : AbstractHandler() {\n- @Throws(IOException::class, ServletException::class)\n- override fun handle(target: String, baseRequest: Request, request: HttpServletRequest, response: HttpServletResponse) {\n- if (!target.startsWith(\"/history/\")) {\n- return\n- }\n- val parts = Arrays.stream(target.split(\"/\".toRegex()).toTypedArray())\n- .filter { it: String? -> it != null && it.length > 0 }\n- .collect(Collectors.toList())\n- if (parts.size == 1) {\n- baseRequest.isHandled = true\n- response.status = HttpServletResponse.SC_OK\n- response.contentType = \"text/html\"\n- buildMainPage(response.writer)\n- return\n- } else if (parts.size == 3) {\n- val repositoryId = parts[1]\n- val branch = parts[2]\n- baseRequest.isHandled = true\n- response.status = HttpServletResponse.SC_OK\n- response.contentType = \"text/html\"\n- val limit = toInt(request.getParameter(\"limit\"), 500)\n- val skip = toInt(request.getParameter(\"skip\"), 0)\n- buildRepositoryPage(response.writer, RepositoryAndBranch(repositoryId, branch), request.getParameter(\"head\"), skip, limit)\n- } else if (parts.size == 4 && parts[3] == \"revert\") {\n- if (request.method == \"POST\") {\n- val repositoryId = parts[1]\n- val branch = parts[2]\n- val fromVersion = request.getParameter(\"from\")\n- val toVersion = request.getParameter(\"to\")\n- if (repositoryId != null && repositoryId.length > 0 && fromVersion != null && fromVersion.length > 0 && toVersion != null && toVersion.length > 0) {\n- revert(RepositoryAndBranch(repositoryId, branch), fromVersion, toVersion, request.getHeader(\"X-Forwarded-Email\"))\n- baseRequest.isHandled = true\n- response.status = HttpServletResponse.SC_OK\n- response.contentType = \"text/html\"\n- response.writer.append(\"<html><head><meta http-equiv='refresh' content='1; url=./' /></head><body>Revert successful</body></html>\")\n- }\n- } else {\n- baseRequest.isHandled = true\n- response.status = HttpServletResponse.SC_METHOD_NOT_ALLOWED\n+class HistoryHandler(private val client: IModelClient) {\n+\n+ fun init(application: Application) {\n+ application.routing {\n+ get(\"/history/\") {\n+ call.respondTextWriter(contentType = ContentType.Text.Html) {\n+ buildMainPage(PrintWriter(this))\n+ }\n+ }\n+ get(\"/history/{repoId}/{branch}/\") {\n+ val repositoryId = call.parameters[\"repoId\"]!!\n+ val branch = call.parameters[\"branch\"]!!\n+ val params = call.receiveParameters()\n+ val limit = toInt(params[\"limit\"], 500)\n+ val skip = toInt(params[\"skip\"], 0)\n+ call.respondTextWriter(contentType = ContentType.Text.Html) {\n+ buildRepositoryPage(PrintWriter(this), RepositoryAndBranch(repositoryId, branch), params[\"head\"], skip, limit)\n+ }\n+ }\n+ post(\"/history/{repoId}/{branch}/revert\") {\n+ val repositoryId = call.parameters[\"repoId\"]!!\n+ val branch = call.parameters[\"branch\"]!!\n+ val params = call.receiveParameters()\n+ val fromVersion = params[\"from\"]!!\n+ val toVersion = params[\"to\"]!!\n+ val user = call.principal<AuthenticatedUser>()?.userIds?.firstOrNull()\n+ revert(RepositoryAndBranch(repositoryId, branch), fromVersion, toVersion, user)\n+ call.respondRedirect(\".\")\n}\n}\n}\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | model server history migrated |
426,504 | 08.06.2022 09:49:38 | -7,200 | ef55acb00afc8e2207b9884576a32d7b40ea82e4 | correct how we handle CloudTransientModel to add devkit and dependencies to them | [
{
"change_type": "MODIFY",
"old_path": "integrationtests/expected_server_dumps/dump4.json",
"new_path": "integrationtests/expected_server_dumps/dump4.json",
"diff": "\"$concept\": \"org.modelix.model.repositoryconcepts.Module\",\n\"id\": \"f2fb433a-7484-46c7-a61e-ec59ba5ea58f\",\n\"name\": \"simple.solution1\",\n+ \"moduleVersion\": \"0\",\n+ \"compileInMPS\": \"true\",\n\"$children\": [\n+ {\n+ \"$role\": \"facets\",\n+ \"$concept\": \"org.modelix.model.repositoryconcepts.JavaModuleFacet\",\n+ \"generated\": \"true\",\n+ \"path\": \"${module}/classes_gen\"\n+ },\n+ {\n+ \"$role\": \"dependencies\",\n+ \"$concept\": \"org.modelix.model.repositoryconcepts.ModuleDependency\",\n+ \"explicit\": \"false\",\n+ \"name\": \"simple.solution1\",\n+ \"reexport\": \"false\",\n+ \"scope\": \"UNSPECIFIED\",\n+ \"uuid\": \"f2fb433a-7484-46c7-a61e-ec59ba5ea58f\",\n+ \"version\": \"0\"\n+ },\n+ {\n+ \"$role\": \"languageDependencies\",\n+ \"$concept\": \"org.modelix.model.repositoryconcepts.SingleLanguageDependency\",\n+ \"name\": \"jetbrains.mps.baseLanguage\",\n+ \"uuid\": \"f3061a53-9226-4cc5-a443-f952ceaf5816\",\n+ \"version\": \"11\"\n+ },\n+ {\n+ \"$role\": \"languageDependencies\",\n+ \"$concept\": \"org.modelix.model.repositoryconcepts.SingleLanguageDependency\",\n+ \"name\": \"jetbrains.mps.lang.core\",\n+ \"uuid\": \"ceab5195-25ea-4f22-9b92-103b95ca8c0c\",\n+ \"version\": \"2\"\n+ },\n+ {\n+ \"$role\": \"languageDependencies\",\n+ \"$concept\": \"org.modelix.model.repositoryconcepts.SingleLanguageDependency\",\n+ \"name\": \"jetbrains.mps.lang.traceable\",\n+ \"uuid\": \"9ded098b-ad6a-4657-bfd9-48636cfe8bc3\",\n+ \"version\": \"0\"\n+ },\n{\n\"$role\": \"models\",\n\"$concept\": \"org.modelix.model.repositoryconcepts.Model\",\n\"$children\": [\n{\n\"$role\": \"usedLanguages\",\n- \"$concept\": \"org.modelix.model.repositoryconcepts.UsedModule\",\n- \"id\": \"f3061a53-9226-4cc5-a443-f952ceaf5816\",\n- \"name\": \"jetbrains.mps.baseLanguage\"\n+ \"$concept\": \"org.modelix.model.repositoryconcepts.SingleLanguageDependency\",\n+ \"uuid\": \"f3061a53-9226-4cc5-a443-f952ceaf5816\",\n+ \"name\": \"jetbrains.mps.baseLanguage\",\n+ \"version\": \"11\"\n},\n{\n\"$role\": \"rootNodes\",\n"
},
{
"change_type": "MODIFY",
"old_path": "integrationtests/expected_server_dumps/dump5.json",
"new_path": "integrationtests/expected_server_dumps/dump5.json",
"diff": "\"$concept\": \"org.modelix.model.repositoryconcepts.Module\",\n\"id\": \"f2fb433a-7484-46c7-a61e-ec59ba5ea58f\",\n\"name\": \"simple.solution1\",\n+ \"moduleVersion\": \"0\",\n+ \"compileInMPS\": \"true\",\n\"$children\": [\n+ {\n+ \"$role\": \"facets\",\n+ \"$concept\": \"org.modelix.model.repositoryconcepts.JavaModuleFacet\",\n+ \"generated\": \"true\",\n+ \"path\": \"${module}/classes_gen\"\n+ },\n+ {\n+ \"$role\": \"dependencies\",\n+ \"$concept\": \"org.modelix.model.repositoryconcepts.ModuleDependency\",\n+ \"explicit\": \"false\",\n+ \"name\": \"simple.solution1\",\n+ \"reexport\": \"false\",\n+ \"scope\": \"UNSPECIFIED\",\n+ \"uuid\": \"f2fb433a-7484-46c7-a61e-ec59ba5ea58f\",\n+ \"version\": \"0\"\n+ },\n+ {\n+ \"$role\": \"languageDependencies\",\n+ \"$concept\": \"org.modelix.model.repositoryconcepts.SingleLanguageDependency\",\n+ \"name\": \"jetbrains.mps.baseLanguage\",\n+ \"uuid\": \"f3061a53-9226-4cc5-a443-f952ceaf5816\",\n+ \"version\": \"11\"\n+ },\n+ {\n+ \"$role\": \"languageDependencies\",\n+ \"$concept\": \"org.modelix.model.repositoryconcepts.SingleLanguageDependency\",\n+ \"name\": \"jetbrains.mps.lang.core\",\n+ \"uuid\": \"ceab5195-25ea-4f22-9b92-103b95ca8c0c\",\n+ \"version\": \"2\"\n+ },\n+ {\n+ \"$role\": \"languageDependencies\",\n+ \"$concept\": \"org.modelix.model.repositoryconcepts.SingleLanguageDependency\",\n+ \"name\": \"jetbrains.mps.lang.traceable\",\n+ \"uuid\": \"9ded098b-ad6a-4657-bfd9-48636cfe8bc3\",\n+ \"version\": \"0\"\n+ },\n{\n\"$role\": \"models\",\n\"$concept\": \"org.modelix.model.repositoryconcepts.Model\",\n\"$children\": [\n{\n\"$role\": \"usedLanguages\",\n- \"$concept\": \"org.modelix.model.repositoryconcepts.UsedModule\",\n- \"id\": \"f3061a53-9226-4cc5-a443-f952ceaf5816\",\n- \"name\": \"jetbrains.mps.baseLanguage\"\n+ \"$concept\": \"org.modelix.model.repositoryconcepts.SingleLanguageDependency\",\n+ \"uuid\": \"f3061a53-9226-4cc5-a443-f952ceaf5816\",\n+ \"name\": \"jetbrains.mps.baseLanguage\",\n+ \"version\": \"11\"\n},\n{\n\"$role\": \"rootNodes\",\n"
},
{
"change_type": "MODIFY",
"old_path": "mps/org.modelix.integrationtests/models/org.modelix.integrationtests.mps",
"new_path": "mps/org.modelix.integrationtests/models/org.modelix.integrationtests.mps",
"diff": "</node>\n</node>\n</node>\n- <node concept=\"2ShNRf\" id=\"5i$4SBK0p2U\" role=\"HW$Y0\">\n+ <node concept=\"1X3_iC\" id=\"3FGOatPoedf\" role=\"lGtFl\">\n+ <property role=\"3V$3am\" value=\"initValue\" />\n+ <property role=\"3V$3ak\" value=\"83888646-71ce-4f1c-9c53-c54016f6ad4f/1237721394592/1237721435808\" />\n+ <node concept=\"2ShNRf\" id=\"5i$4SBK0p2U\" role=\"8Wnug\">\n<node concept=\"1pGfFk\" id=\"5i$4SBK0p2V\" role=\"2ShVmc\">\n<ref role=\"37wK5l\" node=\"5i$4SBK0dxT\" resolve=\"ModuleCanBeCopiedOnAndSyncedCloudTest\" />\n<node concept=\"37vLTw\" id=\"5i$4SBK0p2W\" role=\"37wK5m\">\n</node>\n</node>\n</node>\n- <node concept=\"1X3_iC\" id=\"4TYoXWzSHKA\" role=\"lGtFl\">\n- <property role=\"3V$3am\" value=\"initValue\" />\n- <property role=\"3V$3ak\" value=\"83888646-71ce-4f1c-9c53-c54016f6ad4f/1237721394592/1237721435808\" />\n- <node concept=\"2ShNRf\" id=\"7jRNnvCjypP\" role=\"8Wnug\">\n+ </node>\n+ <node concept=\"2ShNRf\" id=\"7jRNnvCjypP\" role=\"HW$Y0\">\n<node concept=\"1pGfFk\" id=\"7jRNnvCjztD\" role=\"2ShVmc\">\n<ref role=\"37wK5l\" node=\"7jRNnvC91jg\" resolve=\"ModuleOnTheCloudCanBeCheckoutAsTransientModuleTest\" />\n<node concept=\"37vLTw\" id=\"7jRNnvCjAi0\" role=\"37wK5m\">\n</node>\n</node>\n</node>\n- </node>\n<node concept=\"1X3_iC\" id=\"4TYoXWzS716\" role=\"lGtFl\">\n<property role=\"3V$3am\" value=\"initValue\" />\n<property role=\"3V$3ak\" value=\"83888646-71ce-4f1c-9c53-c54016f6ad4f/1237721394592/1237721435808\" />\n</node>\n</node>\n</node>\n- <node concept=\"abc8K\" id=\"5cWpYFRKOK1\" role=\"3cqZAp\">\n- <node concept=\"Xl_RD\" id=\"5cWpYFRKOK2\" role=\"abp_N\">\n- <property role=\"Xl_RC\" value=\"USING CR \" />\n- </node>\n- <node concept=\"2OqwBi\" id=\"5cWpYFRKOK3\" role=\"abp_N\">\n- <node concept=\"37vLTw\" id=\"5cWpYFRKOK4\" role=\"2Oq$k0\">\n- <ref role=\"3cqZAo\" node=\"7jRNnvC91l2\" resolve=\"msc\" />\n- </node>\n- <node concept=\"liA8E\" id=\"5cWpYFRKOK5\" role=\"2OqNvi\">\n- <ref role=\"37wK5l\" to=\"csg2:6aRQr1WQLS7\" resolve=\"getBaseUrl\" />\n- </node>\n- </node>\n- </node>\n<node concept=\"3clFbF\" id=\"7jRNnvC91l5\" role=\"3cqZAp\">\n<node concept=\"2YIFZM\" id=\"7jRNnvC91l6\" role=\"3clFbG\">\n<ref role=\"1Pybhc\" to=\"wyt6:~Thread\" resolve=\"Thread\" />\n"
},
{
"change_type": "MODIFY",
"old_path": "mps/org.modelix.model.mpsplugin/models/org.modelix.model.mpsplugin.mps",
"new_path": "mps/org.modelix.model.mpsplugin/models/org.modelix.model.mpsplugin.mps",
"diff": "</node>\n</node>\n</node>\n+ <node concept=\"ATzpf\" id=\"3FGOatPqNuV\" role=\"a7sos\">\n+ <property role=\"TrG5h\" value=\"addDevKit\" />\n+ <node concept=\"37vLTG\" id=\"3FGOatPqREV\" role=\"3clF46\">\n+ <property role=\"TrG5h\" value=\"devKitModuleReference\" />\n+ <node concept=\"3uibUv\" id=\"3FGOatPqREX\" role=\"1tU5fm\">\n+ <ref role=\"3uigEE\" to=\"lui2:~SModuleReference\" resolve=\"SModuleReference\" />\n+ </node>\n+ </node>\n+ <node concept=\"3Tm1VV\" id=\"3FGOatPqNuW\" role=\"1B3o_S\" />\n+ <node concept=\"3cqZAl\" id=\"3FGOatPqN_i\" role=\"3clF45\" />\n+ <node concept=\"3clFbS\" id=\"3FGOatPqNuY\" role=\"3clF47\">\n+ <node concept=\"3clFbJ\" id=\"3FGOatPqOC1\" role=\"3cqZAp\">\n+ <node concept=\"3clFbS\" id=\"3FGOatPqOC2\" role=\"3clFbx\">\n+ <node concept=\"3cpWs8\" id=\"3FGOatPqOC3\" role=\"3cqZAp\">\n+ <node concept=\"3cpWsn\" id=\"3FGOatPqOC4\" role=\"3cpWs9\">\n+ <property role=\"TrG5h\" value=\"dsmd\" />\n+ <node concept=\"3uibUv\" id=\"3FGOatPrtbT\" role=\"1tU5fm\">\n+ <ref role=\"3uigEE\" to=\"g3l6:~SModelDescriptorStub\" resolve=\"SModelDescriptorStub\" />\n+ </node>\n+ <node concept=\"1eOMI4\" id=\"3FGOatPqOC6\" role=\"33vP2m\">\n+ <node concept=\"10QFUN\" id=\"3FGOatPqOC7\" role=\"1eOMHV\">\n+ <node concept=\"3uibUv\" id=\"3FGOatPrt78\" role=\"10QFUM\">\n+ <ref role=\"3uigEE\" to=\"g3l6:~SModelDescriptorStub\" resolve=\"SModelDescriptorStub\" />\n+ </node>\n+ <node concept=\"2V_BSl\" id=\"3FGOatPqRsE\" role=\"10QFUP\" />\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ <node concept=\"3clFbF\" id=\"3FGOatPqOCJ\" role=\"3cqZAp\">\n+ <node concept=\"2OqwBi\" id=\"3FGOatPqOCK\" role=\"3clFbG\">\n+ <node concept=\"37vLTw\" id=\"3FGOatPqOCL\" role=\"2Oq$k0\">\n+ <ref role=\"3cqZAo\" node=\"3FGOatPqOC4\" resolve=\"dsmd\" />\n+ </node>\n+ <node concept=\"liA8E\" id=\"3FGOatPqOCM\" role=\"2OqNvi\">\n+ <ref role=\"37wK5l\" to=\"g3l6:~SModelDescriptorStub.addDevKit(org.jetbrains.mps.openapi.module.SModuleReference)\" resolve=\"addDevKit\" />\n+ <node concept=\"37vLTw\" id=\"3FGOatPqWdS\" role=\"37wK5m\">\n+ <ref role=\"3cqZAo\" node=\"3FGOatPqREV\" resolve=\"devKitModuleReference\" />\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ <node concept=\"2ZW3vV\" id=\"3FGOatPqOEp\" role=\"3clFbw\">\n+ <node concept=\"3uibUv\" id=\"3FGOatPrsQh\" role=\"2ZW6by\">\n+ <ref role=\"3uigEE\" to=\"g3l6:~SModelDescriptorStub\" resolve=\"SModelDescriptorStub\" />\n+ </node>\n+ <node concept=\"2V_BSl\" id=\"3FGOatPqQBm\" role=\"2ZW6bz\" />\n+ </node>\n+ <node concept=\"9aQIb\" id=\"3FGOatPqOEI\" role=\"9aQIa\">\n+ <node concept=\"3clFbS\" id=\"3FGOatPqOEJ\" role=\"9aQI4\">\n+ <node concept=\"YS8fn\" id=\"3FGOatPqOEK\" role=\"3cqZAp\">\n+ <node concept=\"2ShNRf\" id=\"3FGOatPqOEL\" role=\"YScLw\">\n+ <node concept=\"1pGfFk\" id=\"3FGOatPqOEM\" role=\"2ShVmc\">\n+ <ref role=\"37wK5l\" to=\"wyt6:~IllegalStateException.<init>(java.lang.String)\" resolve=\"IllegalStateException\" />\n+ <node concept=\"3cpWs3\" id=\"3FGOatPqOEN\" role=\"37wK5m\">\n+ <node concept=\"Xl_RD\" id=\"3FGOatPqOEO\" role=\"3uHU7w\">\n+ <property role=\"Xl_RC\" value=\")\" />\n+ </node>\n+ <node concept=\"3cpWs3\" id=\"3FGOatPqOEP\" role=\"3uHU7B\">\n+ <node concept=\"3cpWs3\" id=\"3FGOatPqOEQ\" role=\"3uHU7B\">\n+ <node concept=\"3cpWs3\" id=\"3FGOatPqOER\" role=\"3uHU7B\">\n+ <node concept=\"Xl_RD\" id=\"3FGOatPqOES\" role=\"3uHU7B\">\n+ <property role=\"Xl_RC\" value=\"Unable to handle this model \" />\n+ </node>\n+ <node concept=\"2V_BSl\" id=\"3FGOatPqZaA\" role=\"3uHU7w\" />\n+ </node>\n+ <node concept=\"Xl_RD\" id=\"3FGOatPqOEW\" role=\"3uHU7w\">\n+ <property role=\"Xl_RC\" value=\" (class: \" />\n+ </node>\n+ </node>\n+ <node concept=\"2OqwBi\" id=\"3FGOatPqOEX\" role=\"3uHU7w\">\n+ <node concept=\"2OqwBi\" id=\"3FGOatPqOEY\" role=\"2Oq$k0\">\n+ <node concept=\"2V_BSl\" id=\"3FGOatPqZtd\" role=\"2Oq$k0\" />\n+ <node concept=\"liA8E\" id=\"3FGOatPqOF2\" role=\"2OqNvi\">\n+ <ref role=\"37wK5l\" to=\"wyt6:~Object.getClass()\" resolve=\"getClass\" />\n+ </node>\n+ </node>\n+ <node concept=\"liA8E\" id=\"3FGOatPqOF3\" role=\"2OqNvi\">\n+ <ref role=\"37wK5l\" to=\"wyt6:~Class.getCanonicalName()\" resolve=\"getCanonicalName\" />\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ <node concept=\"ATzpf\" id=\"3FGOatPraKL\" role=\"a7sos\">\n+ <property role=\"TrG5h\" value=\"addLanguageImport\" />\n+ <node concept=\"37vLTG\" id=\"3FGOatPraKM\" role=\"3clF46\">\n+ <property role=\"TrG5h\" value=\"sLanguage\" />\n+ <node concept=\"3uibUv\" id=\"3FGOatPrbtf\" role=\"1tU5fm\">\n+ <ref role=\"3uigEE\" to=\"c17a:~SLanguage\" resolve=\"SLanguage\" />\n+ </node>\n+ </node>\n+ <node concept=\"37vLTG\" id=\"3FGOatPreO8\" role=\"3clF46\">\n+ <property role=\"TrG5h\" value=\"version\" />\n+ <node concept=\"10Oyi0\" id=\"3FGOatPrf64\" role=\"1tU5fm\" />\n+ </node>\n+ <node concept=\"3Tm1VV\" id=\"3FGOatPraKO\" role=\"1B3o_S\" />\n+ <node concept=\"3cqZAl\" id=\"3FGOatPraKP\" role=\"3clF45\" />\n+ <node concept=\"3clFbS\" id=\"3FGOatPraKQ\" role=\"3clF47\">\n+ <node concept=\"3clFbJ\" id=\"3FGOatPraKR\" role=\"3cqZAp\">\n+ <node concept=\"3clFbS\" id=\"3FGOatPraKS\" role=\"3clFbx\">\n+ <node concept=\"3cpWs8\" id=\"3FGOatPraKT\" role=\"3cqZAp\">\n+ <node concept=\"3cpWsn\" id=\"3FGOatPraKU\" role=\"3cpWs9\">\n+ <property role=\"TrG5h\" value=\"dsmd\" />\n+ <node concept=\"3uibUv\" id=\"3FGOatPrtBb\" role=\"1tU5fm\">\n+ <ref role=\"3uigEE\" to=\"g3l6:~SModelDescriptorStub\" resolve=\"SModelDescriptorStub\" />\n+ </node>\n+ <node concept=\"1eOMI4\" id=\"3FGOatPraKW\" role=\"33vP2m\">\n+ <node concept=\"10QFUN\" id=\"3FGOatPraKX\" role=\"1eOMHV\">\n+ <node concept=\"3uibUv\" id=\"3FGOatPrtwL\" role=\"10QFUM\">\n+ <ref role=\"3uigEE\" to=\"g3l6:~SModelDescriptorStub\" resolve=\"SModelDescriptorStub\" />\n+ </node>\n+ <node concept=\"2V_BSl\" id=\"3FGOatPraKZ\" role=\"10QFUP\" />\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ <node concept=\"3clFbF\" id=\"3FGOatPrehe\" role=\"3cqZAp\">\n+ <node concept=\"2OqwBi\" id=\"3FGOatPrehf\" role=\"3clFbG\">\n+ <node concept=\"37vLTw\" id=\"3FGOatPrehg\" role=\"2Oq$k0\">\n+ <ref role=\"3cqZAo\" node=\"3FGOatPraKU\" resolve=\"dsmd\" />\n+ </node>\n+ <node concept=\"liA8E\" id=\"3FGOatPrehh\" role=\"2OqNvi\">\n+ <ref role=\"37wK5l\" to=\"g3l6:~SModelDescriptorStub.addLanguage(org.jetbrains.mps.openapi.language.SLanguage)\" resolve=\"addLanguage\" />\n+ <node concept=\"37vLTw\" id=\"3FGOatPrehi\" role=\"37wK5m\">\n+ <ref role=\"3cqZAo\" node=\"3FGOatPraKM\" resolve=\"sLanguage\" />\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ <node concept=\"3clFbF\" id=\"3FGOatPrehj\" role=\"3cqZAp\">\n+ <node concept=\"2OqwBi\" id=\"3FGOatPrehk\" role=\"3clFbG\">\n+ <node concept=\"37vLTw\" id=\"3FGOatPrehl\" role=\"2Oq$k0\">\n+ <ref role=\"3cqZAo\" node=\"3FGOatPraKU\" resolve=\"dsmd\" />\n+ </node>\n+ <node concept=\"liA8E\" id=\"3FGOatPrehm\" role=\"2OqNvi\">\n+ <ref role=\"37wK5l\" to=\"g3l6:~SModelDescriptorStub.setLanguageImportVersion(org.jetbrains.mps.openapi.language.SLanguage,int)\" resolve=\"setLanguageImportVersion\" />\n+ <node concept=\"37vLTw\" id=\"3FGOatPrehn\" role=\"37wK5m\">\n+ <ref role=\"3cqZAo\" node=\"3FGOatPraKM\" resolve=\"sLanguage\" />\n+ </node>\n+ <node concept=\"37vLTw\" id=\"3FGOatPrfxL\" role=\"37wK5m\">\n+ <ref role=\"3cqZAo\" node=\"3FGOatPreO8\" resolve=\"version\" />\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ <node concept=\"2ZW3vV\" id=\"3FGOatPraL5\" role=\"3clFbw\">\n+ <node concept=\"3uibUv\" id=\"3FGOatPrtsr\" role=\"2ZW6by\">\n+ <ref role=\"3uigEE\" to=\"g3l6:~SModelDescriptorStub\" resolve=\"SModelDescriptorStub\" />\n+ </node>\n+ <node concept=\"2V_BSl\" id=\"3FGOatPraL7\" role=\"2ZW6bz\" />\n+ </node>\n+ <node concept=\"9aQIb\" id=\"3FGOatPraLn\" role=\"9aQIa\">\n+ <node concept=\"3clFbS\" id=\"3FGOatPraLo\" role=\"9aQI4\">\n+ <node concept=\"YS8fn\" id=\"3FGOatPraLp\" role=\"3cqZAp\">\n+ <node concept=\"2ShNRf\" id=\"3FGOatPraLq\" role=\"YScLw\">\n+ <node concept=\"1pGfFk\" id=\"3FGOatPraLr\" role=\"2ShVmc\">\n+ <ref role=\"37wK5l\" to=\"wyt6:~IllegalStateException.<init>(java.lang.String)\" resolve=\"IllegalStateException\" />\n+ <node concept=\"3cpWs3\" id=\"3FGOatPraLs\" role=\"37wK5m\">\n+ <node concept=\"Xl_RD\" id=\"3FGOatPraLt\" role=\"3uHU7w\">\n+ <property role=\"Xl_RC\" value=\")\" />\n+ </node>\n+ <node concept=\"3cpWs3\" id=\"3FGOatPraLu\" role=\"3uHU7B\">\n+ <node concept=\"3cpWs3\" id=\"3FGOatPraLv\" role=\"3uHU7B\">\n+ <node concept=\"3cpWs3\" id=\"3FGOatPraLw\" role=\"3uHU7B\">\n+ <node concept=\"Xl_RD\" id=\"3FGOatPraLx\" role=\"3uHU7B\">\n+ <property role=\"Xl_RC\" value=\"Unable to handle this model \" />\n+ </node>\n+ <node concept=\"2V_BSl\" id=\"3FGOatPraLy\" role=\"3uHU7w\" />\n+ </node>\n+ <node concept=\"Xl_RD\" id=\"3FGOatPraLz\" role=\"3uHU7w\">\n+ <property role=\"Xl_RC\" value=\" (class: \" />\n+ </node>\n+ </node>\n+ <node concept=\"2OqwBi\" id=\"3FGOatPraL$\" role=\"3uHU7w\">\n+ <node concept=\"2OqwBi\" id=\"3FGOatPraL_\" role=\"2Oq$k0\">\n+ <node concept=\"2V_BSl\" id=\"3FGOatPraLA\" role=\"2Oq$k0\" />\n+ <node concept=\"liA8E\" id=\"3FGOatPraLB\" role=\"2OqNvi\">\n+ <ref role=\"37wK5l\" to=\"wyt6:~Object.getClass()\" resolve=\"getClass\" />\n+ </node>\n+ </node>\n+ <node concept=\"liA8E\" id=\"3FGOatPraLC\" role=\"2OqNvi\">\n+ <ref role=\"37wK5l\" to=\"wyt6:~Class.getCanonicalName()\" resolve=\"getCanonicalName\" />\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n<node concept=\"3uibUv\" id=\"P$XCSQP_7W\" role=\"KRMoO\">\n<ref role=\"3uigEE\" to=\"mhbf:~SModel\" resolve=\"SModel\" />\n</node>\n</node>\n<node concept=\"3clFbJ\" id=\"ON_jCgb8Gj\" role=\"3cqZAp\">\n<node concept=\"3clFbS\" id=\"ON_jCgb8Gk\" role=\"3clFbx\">\n- <node concept=\"3cpWs8\" id=\"4TYoXW$4pQe\" role=\"3cqZAp\">\n- <node concept=\"3cpWsn\" id=\"4TYoXW$4pQf\" role=\"3cpWs9\">\n- <property role=\"TrG5h\" value=\"dsmd\" />\n- <node concept=\"3uibUv\" id=\"4TYoXW$4pQg\" role=\"1tU5fm\">\n- <ref role=\"3uigEE\" to=\"w1kc:~DefaultSModelDescriptor\" resolve=\"DefaultSModelDescriptor\" />\n- </node>\n- <node concept=\"1eOMI4\" id=\"4TYoXW$4rlj\" role=\"33vP2m\">\n- <node concept=\"10QFUN\" id=\"4TYoXW$4rlg\" role=\"1eOMHV\">\n- <node concept=\"3uibUv\" id=\"4TYoXW$4rll\" role=\"10QFUM\">\n- <ref role=\"3uigEE\" to=\"w1kc:~DefaultSModelDescriptor\" resolve=\"DefaultSModelDescriptor\" />\n- </node>\n- <node concept=\"2OqwBi\" id=\"4TYoXW$4o1u\" role=\"10QFUP\">\n- <node concept=\"37vLTw\" id=\"4TYoXW$4mUj\" role=\"2Oq$k0\">\n- <ref role=\"3cqZAo\" node=\"ON_jCgb8EJ\" resolve=\"mpsModelNode\" />\n- </node>\n- <node concept=\"liA8E\" id=\"4TYoXW$4osd\" role=\"2OqNvi\">\n- <ref role=\"37wK5l\" to=\"xxte:qmkA5fQFVR\" resolve=\"getElement\" />\n- </node>\n- </node>\n- </node>\n- </node>\n- </node>\n- </node>\n<node concept=\"3clFbJ\" id=\"4TYoXW$4w_v\" role=\"3cqZAp\">\n<node concept=\"3clFbS\" id=\"4TYoXW$4w_x\" role=\"3clFbx\">\n<node concept=\"3cpWs8\" id=\"1KFUeW2kzuo\" role=\"3cqZAp\">\n</node>\n</node>\n<node concept=\"3clFbF\" id=\"1KFUeW2kx8m\" role=\"3cqZAp\">\n- <node concept=\"2OqwBi\" id=\"1KFUeW2kyn9\" role=\"3clFbG\">\n- <node concept=\"37vLTw\" id=\"1KFUeW2kx8k\" role=\"2Oq$k0\">\n- <ref role=\"3cqZAo\" node=\"4TYoXW$4pQf\" resolve=\"dsmd\" />\n+ <node concept=\"2OqwBi\" id=\"3FGOatPr9tP\" role=\"3clFbG\">\n+ <node concept=\"2OqwBi\" id=\"3FGOatPr2QW\" role=\"2Oq$k0\">\n+ <node concept=\"37vLTw\" id=\"3FGOatPr2QX\" role=\"2Oq$k0\">\n+ <ref role=\"3cqZAo\" node=\"ON_jCgb8EJ\" resolve=\"mpsModelNode\" />\n</node>\n- <node concept=\"liA8E\" id=\"1KFUeW2kzjV\" role=\"2OqNvi\">\n- <ref role=\"37wK5l\" to=\"g3l6:~SModelDescriptorStub.addDevKit(org.jetbrains.mps.openapi.module.SModuleReference)\" resolve=\"addDevKit\" />\n- <node concept=\"37vLTw\" id=\"1KFUeW2kMdZ\" role=\"37wK5m\">\n+ <node concept=\"liA8E\" id=\"3FGOatPr2QY\" role=\"2OqNvi\">\n+ <ref role=\"37wK5l\" to=\"xxte:qmkA5fQFVR\" resolve=\"getElement\" />\n+ </node>\n+ </node>\n+ <node concept=\"AQDAd\" id=\"3FGOatPr9YH\" role=\"2OqNvi\">\n+ <ref role=\"37wK5l\" node=\"3FGOatPqNuV\" resolve=\"addDevKit\" />\n+ <node concept=\"37vLTw\" id=\"3FGOatPra$O\" role=\"37wK5m\">\n<ref role=\"3cqZAo\" node=\"1KFUeW2kEIl\" resolve=\"devKitModuleReference\" />\n</node>\n</node>\n</node>\n</node>\n</node>\n- <node concept=\"3clFbF\" id=\"1KFUeW2ibbr\" role=\"3cqZAp\">\n- <node concept=\"2OqwBi\" id=\"1KFUeW2icrh\" role=\"3clFbG\">\n- <node concept=\"37vLTw\" id=\"1KFUeW2ibbq\" role=\"2Oq$k0\">\n- <ref role=\"3cqZAo\" node=\"4TYoXW$4pQf\" resolve=\"dsmd\" />\n- </node>\n- <node concept=\"liA8E\" id=\"1KFUeW2idmz\" role=\"2OqNvi\">\n- <ref role=\"37wK5l\" to=\"g3l6:~SModelDescriptorStub.addLanguage(org.jetbrains.mps.openapi.language.SLanguage)\" resolve=\"addLanguage\" />\n- <node concept=\"37vLTw\" id=\"1KFUeW2ikNr\" role=\"37wK5m\">\n- <ref role=\"3cqZAo\" node=\"1KFUeW2igH2\" resolve=\"sLanguage\" />\n- </node>\n- </node>\n+ <node concept=\"3clFbF\" id=\"3FGOatPrie7\" role=\"3cqZAp\">\n+ <node concept=\"2OqwBi\" id=\"3FGOatPrimJ\" role=\"3clFbG\">\n+ <node concept=\"2OqwBi\" id=\"3FGOatPrie9\" role=\"2Oq$k0\">\n+ <node concept=\"37vLTw\" id=\"3FGOatPriea\" role=\"2Oq$k0\">\n+ <ref role=\"3cqZAo\" node=\"ON_jCgb8EJ\" resolve=\"mpsModelNode\" />\n</node>\n+ <node concept=\"liA8E\" id=\"3FGOatPrieb\" role=\"2OqNvi\">\n+ <ref role=\"37wK5l\" to=\"xxte:qmkA5fQFVR\" resolve=\"getElement\" />\n</node>\n- <node concept=\"3clFbF\" id=\"1KFUeW2ihqz\" role=\"3cqZAp\">\n- <node concept=\"2OqwBi\" id=\"1KFUeW2iiOf\" role=\"3clFbG\">\n- <node concept=\"37vLTw\" id=\"1KFUeW2ihqx\" role=\"2Oq$k0\">\n- <ref role=\"3cqZAo\" node=\"4TYoXW$4pQf\" resolve=\"dsmd\" />\n</node>\n- <node concept=\"liA8E\" id=\"1KFUeW2ijAv\" role=\"2OqNvi\">\n- <ref role=\"37wK5l\" to=\"g3l6:~SModelDescriptorStub.setLanguageImportVersion(org.jetbrains.mps.openapi.language.SLanguage,int)\" resolve=\"setLanguageImportVersion\" />\n- <node concept=\"37vLTw\" id=\"1KFUeW2im0w\" role=\"37wK5m\">\n+ <node concept=\"AQDAd\" id=\"3FGOatPriRm\" role=\"2OqNvi\">\n+ <ref role=\"37wK5l\" node=\"3FGOatPraKL\" resolve=\"addLanguageImport\" />\n+ <node concept=\"37vLTw\" id=\"3FGOatPrk1z\" role=\"37wK5m\">\n<ref role=\"3cqZAo\" node=\"1KFUeW2igH2\" resolve=\"sLanguage\" />\n</node>\n- <node concept=\"2YIFZM\" id=\"1KFUeW2iHYe\" role=\"37wK5m\">\n+ <node concept=\"2YIFZM\" id=\"3FGOatPrk4v\" role=\"37wK5m\">\n<ref role=\"1Pybhc\" to=\"wyt6:~Integer\" resolve=\"Integer\" />\n<ref role=\"37wK5l\" to=\"wyt6:~Integer.parseInt(java.lang.String)\" resolve=\"parseInt\" />\n- <node concept=\"2OqwBi\" id=\"1KFUeW2ixT_\" role=\"37wK5m\">\n- <node concept=\"2GrUjf\" id=\"1KFUeW2iwY5\" role=\"2Oq$k0\">\n+ <node concept=\"2OqwBi\" id=\"3FGOatPrk4w\" role=\"37wK5m\">\n+ <node concept=\"2GrUjf\" id=\"3FGOatPrk4x\" role=\"2Oq$k0\">\n<ref role=\"2Gs0qQ\" node=\"ON_jCgb8FS\" resolve=\"dependencyInCloud\" />\n</node>\n- <node concept=\"liA8E\" id=\"1KFUeW2iyN3\" role=\"2OqNvi\">\n+ <node concept=\"liA8E\" id=\"3FGOatPrk4y\" role=\"2OqNvi\">\n<ref role=\"37wK5l\" to=\"jks5:~INode.getPropertyValue(java.lang.String)\" resolve=\"getPropertyValue\" />\n- <node concept=\"2OqwBi\" id=\"1KFUeW2iCcv\" role=\"37wK5m\">\n- <node concept=\"355D3s\" id=\"1KFUeW2i$BR\" role=\"2Oq$k0\">\n+ <node concept=\"2OqwBi\" id=\"3FGOatPrk4z\" role=\"37wK5m\">\n+ <node concept=\"355D3s\" id=\"3FGOatPrk4$\" role=\"2Oq$k0\">\n<ref role=\"355D3t\" to=\"jh6v:1UvRDkPap5X\" resolve=\"SingleLanguageDependency\" />\n<ref role=\"355D3u\" to=\"jh6v:1UvRDkPap63\" resolve=\"version\" />\n</node>\n- <node concept=\"liA8E\" id=\"1KFUeW2iD54\" role=\"2OqNvi\">\n+ <node concept=\"liA8E\" id=\"3FGOatPrk4_\" role=\"2OqNvi\">\n<ref role=\"37wK5l\" to=\"c17a:~SProperty.getName()\" resolve=\"getName\" />\n</node>\n</node>\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | correct how we handle CloudTransientModel to add devkit and dependencies to them |
426,504 | 08.06.2022 10:08:42 | -7,200 | 180a2a1f3e21ef47c0420d7fd948b9b61175a956 | correcting remaining integration tests | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "integrationtests/expected_server_dumps/.gitignore",
"diff": "+*.expected.json\n"
},
{
"change_type": "MODIFY",
"old_path": "integrationtests/expected_server_dumps/dump5b.json",
"new_path": "integrationtests/expected_server_dumps/dump5b.json",
"diff": "\"$concept\": \"org.modelix.model.repositoryconcepts.Module\",\n\"id\": \"f2fb433a-5555-46c7-a61e-ec59ba5ea58f\",\n\"name\": \"simple.solution1\",\n+ \"moduleVersion\": \"0\",\n+ \"compileInMPS\": \"true\",\n\"$children\": [\n+ {\n+ \"$role\": \"facets\",\n+ \"$concept\": \"org.modelix.model.repositoryconcepts.JavaModuleFacet\",\n+ \"generated\": \"true\",\n+ \"path\": \"${module}/classes_gen\"\n+ },\n+ {\n+ \"$role\": \"dependencies\",\n+ \"$concept\": \"org.modelix.model.repositoryconcepts.ModuleDependency\",\n+ \"explicit\": \"false\",\n+ \"name\": \"simple.solution1\",\n+ \"reexport\": \"false\",\n+ \"scope\": \"UNSPECIFIED\",\n+ \"uuid\": \"f2fb433a-7484-46c7-a61e-ec59ba5ea58f\",\n+ \"version\": \"0\"\n+ },\n+ {\n+ \"$role\": \"languageDependencies\",\n+ \"$concept\": \"org.modelix.model.repositoryconcepts.SingleLanguageDependency\",\n+ \"name\": \"jetbrains.mps.baseLanguage\",\n+ \"uuid\": \"f3061a53-9226-4cc5-a443-f952ceaf5816\",\n+ \"version\": \"11\"\n+ },\n+ {\n+ \"$role\": \"languageDependencies\",\n+ \"$concept\": \"org.modelix.model.repositoryconcepts.SingleLanguageDependency\",\n+ \"name\": \"jetbrains.mps.lang.core\",\n+ \"uuid\": \"ceab5195-25ea-4f22-9b92-103b95ca8c0c\",\n+ \"version\": \"2\"\n+ },\n+ {\n+ \"$role\": \"languageDependencies\",\n+ \"$concept\": \"org.modelix.model.repositoryconcepts.SingleLanguageDependency\",\n+ \"name\": \"jetbrains.mps.lang.traceable\",\n+ \"uuid\": \"9ded098b-ad6a-4657-bfd9-48636cfe8bc3\",\n+ \"version\": \"0\"\n+ },\n{\n\"$role\": \"models\",\n\"$concept\": \"org.modelix.model.repositoryconcepts.Model\",\n\"$children\": [\n{\n\"$role\": \"usedLanguages\",\n- \"$concept\": \"org.modelix.model.repositoryconcepts.UsedModule\",\n- \"id\": \"f3061a53-9226-4cc5-a443-f952ceaf5816\",\n- \"name\": \"jetbrains.mps.baseLanguage\"\n+ \"$concept\": \"org.modelix.model.repositoryconcepts.SingleLanguageDependency\",\n+ \"uuid\": \"f3061a53-9226-4cc5-a443-f952ceaf5816\",\n+ \"name\": \"jetbrains.mps.baseLanguage\",\n+ \"version\": \"11\"\n},\n{\n\"$role\": \"rootNodes\",\n"
},
{
"change_type": "MODIFY",
"old_path": "integrationtests/expected_server_dumps/dump6.json",
"new_path": "integrationtests/expected_server_dumps/dump6.json",
"diff": "\"$concept\": \"org.modelix.model.repositoryconcepts.Module\",\n\"id\": \"f2fb433a-5555-46c7-a61e-ec59ba5ea58f\",\n\"name\": \"simple.solution1\",\n+ \"moduleVersion\": \"0\",\n+ \"compileInMPS\": \"true\",\n\"$children\": [\n+ {\n+ \"$role\": \"facets\",\n+ \"$concept\": \"org.modelix.model.repositoryconcepts.JavaModuleFacet\",\n+ \"generated\": \"true\",\n+ \"path\": \"${module}/classes_gen\"\n+ },\n+ {\n+ \"$role\": \"dependencies\",\n+ \"$concept\": \"org.modelix.model.repositoryconcepts.ModuleDependency\",\n+ \"explicit\": \"false\",\n+ \"name\": \"simple.solution1\",\n+ \"reexport\": \"false\",\n+ \"scope\": \"UNSPECIFIED\",\n+ \"uuid\": \"f2fb433a-7484-46c7-a61e-ec59ba5ea58f\",\n+ \"version\": \"0\"\n+ },\n+ {\n+ \"$role\": \"languageDependencies\",\n+ \"$concept\": \"org.modelix.model.repositoryconcepts.SingleLanguageDependency\",\n+ \"name\": \"jetbrains.mps.baseLanguage\",\n+ \"uuid\": \"f3061a53-9226-4cc5-a443-f952ceaf5816\",\n+ \"version\": \"11\"\n+ },\n+ {\n+ \"$role\": \"languageDependencies\",\n+ \"$concept\": \"org.modelix.model.repositoryconcepts.SingleLanguageDependency\",\n+ \"name\": \"jetbrains.mps.lang.core\",\n+ \"uuid\": \"ceab5195-25ea-4f22-9b92-103b95ca8c0c\",\n+ \"version\": \"2\"\n+ },\n+ {\n+ \"$role\": \"languageDependencies\",\n+ \"$concept\": \"org.modelix.model.repositoryconcepts.SingleLanguageDependency\",\n+ \"name\": \"jetbrains.mps.lang.traceable\",\n+ \"uuid\": \"9ded098b-ad6a-4657-bfd9-48636cfe8bc3\",\n+ \"version\": \"0\"\n+ },\n{\n\"$role\": \"models\",\n\"$concept\": \"org.modelix.model.repositoryconcepts.Model\",\n\"$children\": [\n{\n\"$role\": \"usedLanguages\",\n- \"$concept\": \"org.modelix.model.repositoryconcepts.UsedModule\",\n- \"id\": \"f3061a53-9226-4cc5-a443-f952ceaf5816\",\n- \"name\": \"jetbrains.mps.baseLanguage\"\n+ \"$concept\": \"org.modelix.model.repositoryconcepts.SingleLanguageDependency\",\n+ \"uuid\": \"f3061a53-9226-4cc5-a443-f952ceaf5816\",\n+ \"name\": \"jetbrains.mps.baseLanguage\",\n+ \"version\": \"11\"\n},\n{\n\"$role\": \"rootNodes\",\n"
},
{
"change_type": "MODIFY",
"old_path": "integrationtests/expected_server_dumps/dump7.json",
"new_path": "integrationtests/expected_server_dumps/dump7.json",
"diff": "\"$concept\": \"org.modelix.model.repositoryconcepts.Module\",\n\"id\": \"f2fb433a-5555-46c7-a61e-ec59ba5ea58f\",\n\"name\": \"simple.solution1\",\n+ \"moduleVersion\": \"0\",\n+ \"compileInMPS\": \"true\",\n\"$children\": [\n+ {\n+ \"$role\": \"facets\",\n+ \"$concept\": \"org.modelix.model.repositoryconcepts.JavaModuleFacet\",\n+ \"generated\": \"true\",\n+ \"path\": \"${module}/classes_gen\"\n+ },\n+ {\n+ \"$role\": \"dependencies\",\n+ \"$concept\": \"org.modelix.model.repositoryconcepts.ModuleDependency\",\n+ \"explicit\": \"false\",\n+ \"name\": \"simple.solution1\",\n+ \"reexport\": \"false\",\n+ \"scope\": \"UNSPECIFIED\",\n+ \"uuid\": \"f2fb433a-7484-46c7-a61e-ec59ba5ea58f\",\n+ \"version\": \"0\"\n+ },\n+ {\n+ \"$role\": \"languageDependencies\",\n+ \"$concept\": \"org.modelix.model.repositoryconcepts.SingleLanguageDependency\",\n+ \"name\": \"jetbrains.mps.baseLanguage\",\n+ \"uuid\": \"f3061a53-9226-4cc5-a443-f952ceaf5816\",\n+ \"version\": \"11\"\n+ },\n+ {\n+ \"$role\": \"languageDependencies\",\n+ \"$concept\": \"org.modelix.model.repositoryconcepts.SingleLanguageDependency\",\n+ \"name\": \"jetbrains.mps.lang.core\",\n+ \"uuid\": \"ceab5195-25ea-4f22-9b92-103b95ca8c0c\",\n+ \"version\": \"2\"\n+ },\n+ {\n+ \"$role\": \"languageDependencies\",\n+ \"$concept\": \"org.modelix.model.repositoryconcepts.SingleLanguageDependency\",\n+ \"name\": \"jetbrains.mps.lang.traceable\",\n+ \"uuid\": \"9ded098b-ad6a-4657-bfd9-48636cfe8bc3\",\n+ \"version\": \"0\"\n+ },\n{\n\"$role\": \"models\",\n\"$concept\": \"org.modelix.model.repositoryconcepts.Model\",\n\"$children\": [\n{\n\"$role\": \"usedLanguages\",\n- \"$concept\": \"org.modelix.model.repositoryconcepts.UsedModule\",\n- \"id\": \"f3061a53-9226-4cc5-a443-f952ceaf5816\",\n- \"name\": \"jetbrains.mps.baseLanguage\"\n+ \"$concept\": \"org.modelix.model.repositoryconcepts.SingleLanguageDependency\",\n+ \"uuid\": \"f3061a53-9226-4cc5-a443-f952ceaf5816\",\n+ \"name\": \"jetbrains.mps.baseLanguage\",\n+ \"version\": \"11\"\n},\n{\n\"$role\": \"rootNodes\",\n"
},
{
"change_type": "MODIFY",
"old_path": "integrationtests/expected_server_dumps/dump8.json",
"new_path": "integrationtests/expected_server_dumps/dump8.json",
"diff": "\"$concept\": \"org.modelix.model.repositoryconcepts.Module\",\n\"id\": \"f2fb433a-5555-46c7-a61e-ec59ba5ea58f\",\n\"name\": \"simple.solution1\",\n+ \"moduleVersion\": \"0\",\n+ \"compileInMPS\": \"true\",\n\"$children\": [\n+ {\n+ \"$role\": \"facets\",\n+ \"$concept\": \"org.modelix.model.repositoryconcepts.JavaModuleFacet\",\n+ \"generated\": \"true\",\n+ \"path\": \"${module}/classes_gen\"\n+ },\n+ {\n+ \"$role\": \"dependencies\",\n+ \"$concept\": \"org.modelix.model.repositoryconcepts.ModuleDependency\",\n+ \"explicit\": \"false\",\n+ \"name\": \"simple.solution1\",\n+ \"reexport\": \"false\",\n+ \"scope\": \"UNSPECIFIED\",\n+ \"uuid\": \"f2fb433a-7484-46c7-a61e-ec59ba5ea58f\",\n+ \"version\": \"0\"\n+ },\n+ {\n+ \"$role\": \"languageDependencies\",\n+ \"$concept\": \"org.modelix.model.repositoryconcepts.SingleLanguageDependency\",\n+ \"name\": \"jetbrains.mps.baseLanguage\",\n+ \"uuid\": \"f3061a53-9226-4cc5-a443-f952ceaf5816\",\n+ \"version\": \"11\"\n+ },\n+ {\n+ \"$role\": \"languageDependencies\",\n+ \"$concept\": \"org.modelix.model.repositoryconcepts.SingleLanguageDependency\",\n+ \"name\": \"jetbrains.mps.lang.core\",\n+ \"uuid\": \"ceab5195-25ea-4f22-9b92-103b95ca8c0c\",\n+ \"version\": \"2\"\n+ },\n+ {\n+ \"$role\": \"languageDependencies\",\n+ \"$concept\": \"org.modelix.model.repositoryconcepts.SingleLanguageDependency\",\n+ \"name\": \"jetbrains.mps.lang.traceable\",\n+ \"uuid\": \"9ded098b-ad6a-4657-bfd9-48636cfe8bc3\",\n+ \"version\": \"0\"\n+ },\n{\n\"$role\": \"models\",\n\"$concept\": \"org.modelix.model.repositoryconcepts.Model\",\n\"$children\": [\n{\n\"$role\": \"usedLanguages\",\n- \"$concept\": \"org.modelix.model.repositoryconcepts.UsedModule\",\n- \"id\": \"f3061a53-9226-4cc5-a443-f952ceaf5816\",\n- \"name\": \"jetbrains.mps.baseLanguage\"\n+ \"$concept\": \"org.modelix.model.repositoryconcepts.SingleLanguageDependency\",\n+ \"uuid\": \"f3061a53-9226-4cc5-a443-f952ceaf5816\",\n+ \"name\": \"jetbrains.mps.baseLanguage\",\n+ \"version\": \"11\"\n},\n{\n\"$role\": \"rootNodes\",\n"
},
{
"change_type": "MODIFY",
"old_path": "mps/org.modelix.integrationtests/models/org.modelix.integrationtests.mps",
"new_path": "mps/org.modelix.integrationtests/models/org.modelix.integrationtests.mps",
"diff": "<node concept=\"3uibUv\" id=\"5yNJPA6buzG\" role=\"HW$YZ\">\n<ref role=\"3uigEE\" node=\"5yNJPA6tjxd\" resolve=\"IntegrationTest\" />\n</node>\n- <node concept=\"1X3_iC\" id=\"4TYoXWzSJ4I\" role=\"lGtFl\">\n- <property role=\"3V$3am\" value=\"initValue\" />\n- <property role=\"3V$3ak\" value=\"83888646-71ce-4f1c-9c53-c54016f6ad4f/1237721394592/1237721435808\" />\n- <node concept=\"2ShNRf\" id=\"6kuATO4qmlk\" role=\"8Wnug\">\n+ <node concept=\"2ShNRf\" id=\"6kuATO4qmlk\" role=\"HW$Y0\">\n<node concept=\"1pGfFk\" id=\"6kuATO4qmll\" role=\"2ShVmc\">\n<ref role=\"37wK5l\" node=\"6kuATO4oeE5\" resolve=\"RepositoryCanBeAddedAndRemembered\" />\n<node concept=\"37vLTw\" id=\"6kuATO4qmlm\" role=\"37wK5m\">\n</node>\n</node>\n</node>\n- </node>\n- <node concept=\"1X3_iC\" id=\"4TYoXWzXG2g\" role=\"lGtFl\">\n- <property role=\"3V$3am\" value=\"initValue\" />\n- <property role=\"3V$3ak\" value=\"83888646-71ce-4f1c-9c53-c54016f6ad4f/1237721394592/1237721435808\" />\n- <node concept=\"2ShNRf\" id=\"lO9TSUBHIm\" role=\"8Wnug\">\n+ <node concept=\"2ShNRf\" id=\"lO9TSUBHIm\" role=\"HW$Y0\">\n<node concept=\"1pGfFk\" id=\"lO9TSUBOeL\" role=\"2ShVmc\">\n<ref role=\"37wK5l\" node=\"lO9TSUBsvB\" resolve=\"ProjectCanBeCopiedAndSyncOnCloudTest\" />\n<node concept=\"37vLTw\" id=\"lO9TSUBOLV\" role=\"37wK5m\">\n</node>\n</node>\n</node>\n- </node>\n- <node concept=\"1X3_iC\" id=\"66kvSbilvvR\" role=\"lGtFl\">\n- <property role=\"3V$3am\" value=\"initValue\" />\n- <property role=\"3V$3ak\" value=\"83888646-71ce-4f1c-9c53-c54016f6ad4f/1237721394592/1237721435808\" />\n- <node concept=\"2ShNRf\" id=\"6Oq35Wg1Xie\" role=\"8Wnug\">\n+ <node concept=\"2ShNRf\" id=\"6Oq35Wg1Xie\" role=\"HW$Y0\">\n<node concept=\"1pGfFk\" id=\"6Oq35Wg1Xif\" role=\"2ShVmc\">\n<ref role=\"37wK5l\" node=\"6Oq35Wg1Gb6\" resolve=\"ProjectCanBeCopiedFromTheCloudToLocalAndSyncedTest\" />\n<node concept=\"37vLTw\" id=\"6Oq35Wg1Xig\" role=\"37wK5m\">\n</node>\n</node>\n</node>\n- </node>\n- <node concept=\"1X3_iC\" id=\"3FGOatPnoPZ\" role=\"lGtFl\">\n- <property role=\"3V$3am\" value=\"initValue\" />\n- <property role=\"3V$3ak\" value=\"83888646-71ce-4f1c-9c53-c54016f6ad4f/1237721394592/1237721435808\" />\n- <node concept=\"2ShNRf\" id=\"11vVX88rG6M\" role=\"8Wnug\">\n+ <node concept=\"2ShNRf\" id=\"11vVX88rG6M\" role=\"HW$Y0\">\n<node concept=\"1pGfFk\" id=\"11vVX88rGJ1\" role=\"2ShVmc\">\n<ref role=\"37wK5l\" node=\"11vVX88rChk\" resolve=\"ModuleCanBeCopiedOnCloudTest\" />\n<node concept=\"37vLTw\" id=\"11vVX88rGTQ\" role=\"37wK5m\">\n</node>\n</node>\n</node>\n- </node>\n- <node concept=\"1X3_iC\" id=\"3FGOatPoedf\" role=\"lGtFl\">\n- <property role=\"3V$3am\" value=\"initValue\" />\n- <property role=\"3V$3ak\" value=\"83888646-71ce-4f1c-9c53-c54016f6ad4f/1237721394592/1237721435808\" />\n- <node concept=\"2ShNRf\" id=\"5i$4SBK0p2U\" role=\"8Wnug\">\n+ <node concept=\"2ShNRf\" id=\"5i$4SBK0p2U\" role=\"HW$Y0\">\n<node concept=\"1pGfFk\" id=\"5i$4SBK0p2V\" role=\"2ShVmc\">\n<ref role=\"37wK5l\" node=\"5i$4SBK0dxT\" resolve=\"ModuleCanBeCopiedOnAndSyncedCloudTest\" />\n<node concept=\"37vLTw\" id=\"5i$4SBK0p2W\" role=\"37wK5m\">\n</node>\n</node>\n</node>\n- </node>\n<node concept=\"2ShNRf\" id=\"7jRNnvCjypP\" role=\"HW$Y0\">\n<node concept=\"1pGfFk\" id=\"7jRNnvCjztD\" role=\"2ShVmc\">\n<ref role=\"37wK5l\" node=\"7jRNnvC91jg\" resolve=\"ModuleOnTheCloudCanBeCheckoutAsTransientModuleTest\" />\n</node>\n</node>\n</node>\n- <node concept=\"1X3_iC\" id=\"4TYoXWzS716\" role=\"lGtFl\">\n- <property role=\"3V$3am\" value=\"initValue\" />\n- <property role=\"3V$3ak\" value=\"83888646-71ce-4f1c-9c53-c54016f6ad4f/1237721394592/1237721435808\" />\n- <node concept=\"2ShNRf\" id=\"7jRNnvCjzOE\" role=\"8Wnug\">\n+ <node concept=\"2ShNRf\" id=\"7jRNnvCjzOE\" role=\"HW$Y0\">\n<node concept=\"1pGfFk\" id=\"7jRNnvCj$UB\" role=\"2ShVmc\">\n<ref role=\"37wK5l\" node=\"7jRNnvCgEAa\" resolve=\"ModuleCanBeCopiedFromTheCloudToLocalProjectTest\" />\n<node concept=\"37vLTw\" id=\"7jRNnvCjArx\" role=\"37wK5m\">\n</node>\n</node>\n</node>\n- </node>\n- <node concept=\"1X3_iC\" id=\"4TYoXWzS717\" role=\"lGtFl\">\n- <property role=\"3V$3am\" value=\"initValue\" />\n- <property role=\"3V$3ak\" value=\"83888646-71ce-4f1c-9c53-c54016f6ad4f/1237721394592/1237721435808\" />\n- <node concept=\"2ShNRf\" id=\"7jRNnvCj_vg\" role=\"8Wnug\">\n+ <node concept=\"2ShNRf\" id=\"7jRNnvCj_vg\" role=\"HW$Y0\">\n<node concept=\"1pGfFk\" id=\"7jRNnvCjA5Q\" role=\"2ShVmc\">\n<ref role=\"37wK5l\" node=\"7jRNnvChqK7\" resolve=\"ModuleCanBeCopiedFromTheCloudToLocalProjectAndSyncedTest\" />\n<node concept=\"37vLTw\" id=\"7jRNnvCjACs\" role=\"37wK5m\">\n</node>\n</node>\n</node>\n- </node>\n<node concept=\"3cpWs8\" id=\"5yNJPA6bDOX\" role=\"3cqZAp\">\n<node concept=\"3cpWsn\" id=\"5yNJPA6bDP0\" role=\"3cpWs9\">\n<property role=\"TrG5h\" value=\"failures\" />\n</node>\n</node>\n</node>\n+ <node concept=\"3clFbF\" id=\"3FGOatPrW$B\" role=\"3cqZAp\">\n+ <node concept=\"2YIFZM\" id=\"3FGOatPrW$C\" role=\"3clFbG\">\n+ <ref role=\"37wK5l\" to=\"wyt6:~Thread.sleep(long)\" resolve=\"sleep\" />\n+ <ref role=\"1Pybhc\" to=\"wyt6:~Thread\" resolve=\"Thread\" />\n+ <node concept=\"3cmrfG\" id=\"3FGOatPrW$D\" role=\"37wK5m\">\n+ <property role=\"3cmrfH\" value=\"2000\" />\n+ </node>\n+ </node>\n+ </node>\n<node concept=\"3cpWs8\" id=\"7jRNnvCjg08\" role=\"3cqZAp\">\n<node concept=\"3cpWsn\" id=\"7jRNnvCjg09\" role=\"3cpWs9\">\n<property role=\"TrG5h\" value=\"actualJsonDump\" />\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | correcting remaining integration tests |
426,504 | 08.06.2022 10:25:06 | -7,200 | c1b2e60a684dab6892d156c72a8d938739902ccf | removing extra logging statements | [
{
"change_type": "MODIFY",
"old_path": "mps/org.modelix.integrationtests/models/org.modelix.integrationtests.mps",
"new_path": "mps/org.modelix.integrationtests/models/org.modelix.integrationtests.mps",
"diff": "</node>\n</node>\n</node>\n- <node concept=\"abc8K\" id=\"4TYoXWzRO0n\" role=\"3cqZAp\">\n- <node concept=\"Xl_RD\" id=\"4TYoXWzRO0o\" role=\"abp_N\">\n- <property role=\"Xl_RC\" value=\"ms started\" />\n- </node>\n- </node>\n- <node concept=\"3clFbH\" id=\"4TYoXWzRNwo\" role=\"3cqZAp\" />\n<node concept=\"3clFbF\" id=\"6kuATO4oeFd\" role=\"3cqZAp\">\n<node concept=\"2YIFZM\" id=\"6kuATO4oeFe\" role=\"3clFbG\">\n<ref role=\"37wK5l\" to=\"wyt6:~Thread.sleep(long)\" resolve=\"sleep\" />\n<ref role=\"37wK5l\" node=\"1QKKVBBCC1x\" resolve=\"addModelServer\" />\n</node>\n</node>\n- <node concept=\"abc8K\" id=\"4TYoXWzRQ7W\" role=\"3cqZAp\">\n- <node concept=\"Xl_RD\" id=\"4TYoXWzRQ7X\" role=\"abp_N\">\n- <property role=\"Xl_RC\" value=\"ms added model server\" />\n- </node>\n- </node>\n- <node concept=\"3clFbH\" id=\"4TYoXWzRPBU\" role=\"3cqZAp\" />\n<node concept=\"3clFbF\" id=\"6kuATO4oeFF\" role=\"3cqZAp\">\n<node concept=\"2YIFZM\" id=\"6kuATO4oeFG\" role=\"3clFbG\">\n<ref role=\"37wK5l\" to=\"wyt6:~Thread.sleep(long)\" resolve=\"sleep\" />\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | removing extra logging statements |
426,496 | 10.06.2022 09:03:21 | -7,200 | 73a5b93ba2a7b302998c21fb7a30aba338ceead5 | Bind model server to correct port | [
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/java/org/modelix/model/server/Main.kt",
"new_path": "model-server/src/main/java/org/modelix/model/server/Main.kt",
"diff": "@@ -185,12 +185,11 @@ object Main {\n}\ntry {\nval portStr = System.getenv(\"MODELIX_SERVER_PORT\")\n- var port = portStr?.toInt() ?: 28101\n+ var port = portStr?.toInt() ?: DEFAULT_PORT\nif (cmdLineArgs.port != null) {\nport = cmdLineArgs.port!!\n}\nLOG.info(\"Port: $port\")\n- val bindTo: InetSocketAddress = InetSocketAddress(InetAddress.getByName(\"0.0.0.0\"), port)\nval storeClient: IStoreClient\nif (cmdLineArgs.inmemory) {\nif (cmdLineArgs.jdbcConfFile != null) {\n@@ -240,7 +239,7 @@ object Main {\n}\nval historyHandler = HistoryHandler(localModelClient)\n- val ktorServer: NettyApplicationEngine = embeddedServer(Netty, port = DEFAULT_PORT) {\n+ val ktorServer: NettyApplicationEngine = embeddedServer(Netty, port = port) {\nmodelServer.init(this)\nhistoryHandler.init(this)\n}\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Bind model server to correct port |
426,496 | 10.06.2022 09:52:56 | -7,200 | c6421fb19b4ef249ad8b6eb7c6041bb9a46e41dc | Finished model server migration to ktor | [
{
"change_type": "MODIFY",
"old_path": "authorization/src/main/kotlin/org/modelix/authorization/ModelServerAuthorizationPersistence.kt",
"new_path": "authorization/src/main/kotlin/org/modelix/authorization/ModelServerAuthorizationPersistence.kt",
"diff": "@@ -32,6 +32,7 @@ class ModelServerAuthorizationPersistence(val client: IModelClient, val dataKey:\n: this(RestWebModelClient(modelServerUrl ?: getModelServerUrl()), dataKey)\nconstructor() : this(null, \"authorization-data\")\n+ constructor(client: IModelClient) : this(client, \"authorization-data\")\noverride fun loadData(): AuthorizationData? {\nval serialized = client.get(dataKey) ?: return null\n"
},
{
"change_type": "MODIFY",
"old_path": "authorization/src/main/kotlin/org/modelix/authorization/ModelixAuthorization.kt",
"new_path": "authorization/src/main/kotlin/org/modelix/authorization/ModelixAuthorization.kt",
"diff": "*/\npackage org.modelix.authorization\n+import org.modelix.model.client.IModelClient\n+\nobject ModelixAuthorization {\nprivate val ADMIN_GROUP = \"modelix-administrators\"\nval AUTHORIZATION_DATA_PERMISSION = PermissionId(\"authorization-data\")\n- var persistence: IAuthorizationPersistence = ModelServerAuthorizationPersistence()\n+ private val defaultPersistence: IAuthorizationPersistence by lazy {\n+ ModelServerAuthorizationPersistence()\n+ }\n+ private var persistenceOverride: IAuthorizationPersistence? = null\n+ private val persistence: IAuthorizationPersistence get() { return persistenceOverride ?: defaultPersistence }\n+\n+ fun init(client: IModelClient? = null) {\n+ init(client?.let { ModelServerAuthorizationPersistence(it) })\n+ }\n+\n+ fun init(persistence: IAuthorizationPersistence? = null) {\n+ this.persistenceOverride = persistence ?: ModelServerAuthorizationPersistence()\n+ }\nfun getData(): AuthorizationData {\nreturn persistence.loadData()\n"
},
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/java/org/modelix/model/server/Main.kt",
"new_path": "model-server/src/main/java/org/modelix/model/server/Main.kt",
"diff": "@@ -23,22 +23,18 @@ import io.ktor.server.engine.*\nimport io.ktor.server.netty.*\nimport org.apache.commons.io.FileUtils\nimport org.apache.ignite.Ignition\n-import org.eclipse.jetty.server.Server\n-import org.eclipse.jetty.server.handler.HandlerList\n-import org.eclipse.jetty.servlet.ServletContextHandler\n+import org.modelix.authorization.ModelixAuthorization\nimport org.slf4j.LoggerFactory\nimport java.io.File\nimport java.io.FileReader\nimport java.io.FileWriter\nimport java.io.IOException\n-import java.net.InetAddress\n-import java.net.InetSocketAddress\nimport java.nio.charset.StandardCharsets\nimport java.sql.Connection\nimport java.sql.DatabaseMetaData\nimport java.sql.ResultSet\nimport java.sql.SQLException\n-import java.util.LinkedList\n+import java.util.*\nimport javax.sql.DataSource\ninternal class CmdLineArgs {\n@@ -238,16 +234,18 @@ object Main {\n)\n}\n+ ModelixAuthorization.init(localModelClient)\nval historyHandler = HistoryHandler(localModelClient)\nval ktorServer: NettyApplicationEngine = embeddedServer(Netty, port = port) {\nmodelServer.init(this)\nhistoryHandler.init(this)\n}\n- ktorServer.start()\n+ ktorServer.start(wait = true)\nLOG.info(\"Server started\")\nRuntime.getRuntime().addShutdownHook(Thread {\ntry {\nktorServer.stop()\n+ LOG.info(\"Server stopped\")\n} catch (ex: Exception) {\nSystem.err.println(\"Exception: \" + ex.message)\nex.printStackTrace()\n"
},
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/kotlin/org/modelix/model/server/KtorModelServer.kt",
"new_path": "model-server/src/main/kotlin/org/modelix/model/server/KtorModelServer.kt",
"diff": "package org.modelix.model.server\nimport io.ktor.server.application.*\n-import io.ktor.server.plugins.cors.*\n+import io.ktor.server.plugins.cors.routing.*\nimport io.ktor.http.*\nimport io.ktor.server.plugins.*\nimport io.ktor.server.plugins.forwardedheaders.*\n@@ -131,9 +131,8 @@ class KtorModelServer(val storeClient: IStoreClient) {\nget(\"/poll/{key}\") {\ncheckAuthorization()\n- val params = call.receiveParameters()\nval key = call.parameters[\"key\"]!!\n- val lastKnownValue = params[\"lastKnownValue\"]\n+ val lastKnownValue = call.request.queryParameters[\"lastKnownValue\"]\ncheckKeyPermission(key)\nval valueFromListener = arrayOfNulls<String>(1)\nval lock = Object()\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Finished model server migration to ktor |
426,496 | 10.06.2022 10:18:12 | -7,200 | c2f78a577f9d855b6a9a010bb300a5a9a0c36e06 | /getAll has to use PUT | [
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/kotlin/org/modelix/model/server/KtorModelServer.kt",
"new_path": "model-server/src/main/kotlin/org/modelix/model/server/KtorModelServer.kt",
"diff": "@@ -254,7 +254,9 @@ class KtorModelServer(val storeClient: IStoreClient) {\n}\n}\n- get(\"/getAll\") {\n+ put(\"/getAll\") {\n+ // PUT is used, because a GET is not allowed to have a request body that changes the result of the\n+ // request. It would be legal for an HTTP proxy to cache all /getAll requests and ignore the body.\ncheckAuthorization()\nval reqJsonStr = call.receiveText()\nval reqJson = JSONArray(reqJsonStr)\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | /getAll has to use PUT |
426,496 | 10.06.2022 10:51:26 | -7,200 | 4922780e6aa4ba775c5cbb54668b3d25db3f97dd | Replaced SSE tests with long poll tests
The SSE endpoint isn't supported anymore.
There is a replacements using long polling. | [
{
"change_type": "MODIFY",
"old_path": "model-server/src/test/java/org/modelix/model/server/functionaltests/Stepdefs.java",
"new_path": "model-server/src/test/java/org/modelix/model/server/functionaltests/Stepdefs.java",
"diff": "@@ -36,12 +36,16 @@ import java.net.URI;\nimport java.net.http.HttpClient;\nimport java.net.http.HttpRequest;\nimport java.net.http.HttpResponse;\n+import java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.LinkedList;\nimport java.util.List;\nimport java.util.Map;\n+import java.util.Objects;\n+import java.util.concurrent.Executor;\n+import java.util.concurrent.Executors;\nimport java.util.regex.Pattern;\nimport java.util.stream.Collectors;\nimport javax.ws.rs.client.Client;\n@@ -58,6 +62,9 @@ public class Stepdefs {\nprivate List<InboundSseEvent> events = new LinkedList<InboundSseEvent>();\nprivate List<HttpResponse<String>> allStringResponses = new LinkedList<>();\n+ private Executor longPollExecutor = Executors.newCachedThreadPool();\n+ private List<String> longPollResults = new ArrayList<String>();\n+\nprivate static final boolean VERBOSE_SERVER = false;\nprivate static final boolean VERBOSE_CONNECTION = false;\n@@ -157,7 +164,7 @@ public class Stepdefs {\nhttpRequest(\"GET\", path);\n}\n- private void httpRequest(String method, String path) {\n+ private String httpRequest(String method, String path) {\ntry {\nvar client = HttpClient.newHttpClient();\nvar request =\n@@ -166,8 +173,9 @@ public class Stepdefs {\n.header(\"accept\", \"application/json\")\n.build();\n- allStringResponses.add(\n- client.send(request, HttpResponse.BodyHandlers.ofString(Charsets.UTF_8)));\n+ HttpResponse<String> result = client.send(request, HttpResponse.BodyHandlers.ofString(Charsets.UTF_8));\n+ allStringResponses.add(result);\n+ return result.body();\n} catch (ConnectException e) {\nif (nRetries > 0) {\nif (VERBOSE_CONNECTION) {\n@@ -180,12 +188,13 @@ public class Stepdefs {\n} catch (InterruptedException e2) {\n}\n- httpRequest(method, path);\n+ return httpRequest(method, path);\n} else {\nthrow new RuntimeException(e);\n}\n} catch (IOException | InterruptedException e) {\ne.printStackTrace();\n+ return null;\n}\n}\n@@ -341,6 +350,25 @@ public class Stepdefs {\nassertTrue(events.stream().anyMatch(e -> e.readData().equals(expectedEventValue)));\n}\n+ @Then(\"Long poll should return {string}\")\n+ public void longPollShouldReturn(String expectedValue) {\n+ try {\n+ Thread.sleep(200);\n+ } catch (InterruptedException e) {\n+\n+ }\n+ assertTrue(longPollResults.stream().anyMatch(e -> Objects.equals(expectedValue, e)));\n+ }\n+ @Then(\"Long poll should NOT return {string}\")\n+ public void longPollShouldNOTReturn(String expectedValue) {\n+ try {\n+ Thread.sleep(200);\n+ } catch (InterruptedException e) {\n+\n+ }\n+ assertTrue(longPollResults.stream().noneMatch(e -> Objects.equals(expectedValue, e)));\n+ }\n+\n@Then(\"I should NOT get an event {string}\")\npublic void iShouldNOTGetAnEvent(String expectedEventValue) {\ntry {\n@@ -364,6 +392,18 @@ public class Stepdefs {\nsource.open();\n}\n+ @When(\"I long poll {string}\")\n+ public void iLongPoll(String path) {\n+ // wait for server to be up\n+ i_visit(\"/\");\n+\n+ longPollExecutor.execute(() -> {\n+ String value = httpRequest(\"GET\", path);\n+ System.out.println(\"Polling \" + path + \" returned \" + value);\n+ longPollResults.add(value);\n+ });\n+ }\n+\n@Then(\"the text of the page should be the same as before\")\npublic void theTextOfThePageShouldBeTheSameAsBefore() {\nString last = allStringResponses.get(allStringResponses.size() - 1).body().strip();\n"
},
{
"change_type": "MODIFY",
"old_path": "model-server/src/test/resources/functionaltests/subscription.feature",
"new_path": "model-server/src/test/resources/functionaltests/subscription.feature",
"diff": "@@ -3,12 +3,12 @@ Feature: Storing routes\nScenario: Events are received after subscription\nGiven the server has been started with in-memory storage\n- When I prepare to receive events from \"/subscribe/dylandog\"\n+ When I long poll \"/poll/dylandog\"\nAnd I PUT on \"/put/dylandog\" the value \"a comic book\"\n- Then I should get an event \"a comic book\"\n+ Then Long poll should return \"a comic book\"\nScenario: Events are received only for the key subscribed\nGiven the server has been started with in-memory storage\n- When I prepare to receive events from \"/subscribe/dylandog\"\n+ When I long poll \"/poll/dylandog\"\nAnd I PUT on \"/put/topolino\" the value \"a comic book\"\n- Then I should NOT get an event \"a comic book\"\n\\ No newline at end of file\n+ Then Long poll should NOT return \"a comic book\"\n\\ No newline at end of file\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Replaced SSE tests with long poll tests
The SSE endpoint isn't supported anymore.
There is a replacements using long polling. |
426,496 | 10.06.2022 12:46:33 | -7,200 | bfc802c96f2ff4e7fb01aa13dfda65a016a2ef13 | fixed /poll/{key} | [
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/java/org/modelix/model/server/CachingStoreClient.kt",
"new_path": "model-server/src/main/java/org/modelix/model/server/CachingStoreClient.kt",
"diff": "@@ -59,11 +59,11 @@ class CachingStoreClient(private val store: IStoreClient) : IStoreClient {\n}\n}\n- override fun listen(key: String?, listener: IKeyListener) {\n+ override fun listen(key: String, listener: IKeyListener) {\nstore.listen(key, listener)\n}\n- override fun removeListener(key: String?, listener: IKeyListener) {\n+ override fun removeListener(key: String, listener: IKeyListener) {\nstore.removeListener(key, listener)\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/java/org/modelix/model/server/IKeyListener.kt",
"new_path": "model-server/src/main/java/org/modelix/model/server/IKeyListener.kt",
"diff": "package org.modelix.model.server\ninterface IKeyListener {\n- fun changed(key: String?, value: String?)\n+ fun changed(key: String, value: String?)\n}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/java/org/modelix/model/server/IStoreClient.kt",
"new_path": "model-server/src/main/java/org/modelix/model/server/IStoreClient.kt",
"diff": "@@ -20,7 +20,7 @@ interface IStoreClient {\nfun getAll(keys: Set<String>): Map<String, String?>\nfun put(key: String, value: String?)\nfun putAll(entries: Map<String, String?>)\n- fun listen(key: String?, listener: IKeyListener)\n- fun removeListener(key: String?, listener: IKeyListener)\n+ fun listen(key: String, listener: IKeyListener)\n+ fun removeListener(key: String, listener: IKeyListener)\nfun generateId(key: String): Long\n}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/java/org/modelix/model/server/IgniteStoreClient.kt",
"new_path": "model-server/src/main/java/org/modelix/model/server/IgniteStoreClient.kt",
"diff": "@@ -93,7 +93,7 @@ class IgniteStoreClient(jdbcConfFile: File?) : IStoreClient {\n}\n}\n- override fun listen(key: String?, listener: IKeyListener) {\n+ override fun listen(key: String, listener: IKeyListener) {\nsynchronized(listeners) {\nval wasSubscribed = listeners.containsKey(key)\nlisteners.put(key, listener)\n@@ -120,7 +120,7 @@ class IgniteStoreClient(jdbcConfFile: File?) : IStoreClient {\n}\n}\n- override fun removeListener(key: String?, listener: IKeyListener) {\n+ override fun removeListener(key: String, listener: IKeyListener) {\nsynchronized(listeners) { listeners.remove(key, listener) }\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/java/org/modelix/model/server/InMemoryStoreClient.kt",
"new_path": "model-server/src/main/java/org/modelix/model/server/InMemoryStoreClient.kt",
"diff": "@@ -56,7 +56,7 @@ class InMemoryStoreClient : IStoreClient {\n}\n@Synchronized\n- override fun listen(key: String?, listener: IKeyListener) {\n+ override fun listen(key: String, listener: IKeyListener) {\nif (!listeners.containsKey(key)) {\nlisteners[key] = LinkedList()\n}\n@@ -64,7 +64,7 @@ class InMemoryStoreClient : IStoreClient {\n}\n@Synchronized\n- override fun removeListener(key: String?, listener: IKeyListener) {\n+ override fun removeListener(key: String, listener: IKeyListener) {\nif (!listeners.containsKey(key)) {\nreturn\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/java/org/modelix/model/server/RedisStoreClient.kt",
"new_path": "model-server/src/main/java/org/modelix/model/server/RedisStoreClient.kt",
"diff": "@@ -68,11 +68,11 @@ class RedisStoreClient : IStoreClient {\n}\n}\n- override fun listen(key: String?, listener: IKeyListener) {\n+ override fun listen(key: String, listener: IKeyListener) {\nthrow UnsupportedOperationException()\n}\n- override fun removeListener(key: String?, listener: IKeyListener) {\n+ override fun removeListener(key: String, listener: IKeyListener) {\nthrow UnsupportedOperationException()\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/kotlin/org/modelix/model/server/KtorModelServer.kt",
"new_path": "model-server/src/main/kotlin/org/modelix/model/server/KtorModelServer.kt",
"diff": "@@ -23,6 +23,8 @@ import io.ktor.server.request.*\nimport io.ktor.server.response.*\nimport io.ktor.server.routing.*\nimport io.ktor.util.pipeline.*\n+import kotlinx.coroutines.delay\n+import kotlinx.coroutines.launch\nimport org.json.JSONArray\nimport org.json.JSONObject\nimport org.modelix.authorization.*\n@@ -131,16 +133,13 @@ class KtorModelServer(val storeClient: IStoreClient) {\nget(\"/poll/{key}\") {\ncheckAuthorization()\n- val key = call.parameters[\"key\"]!!\n+ val key: String = call.parameters[\"key\"]!!\nval lastKnownValue = call.request.queryParameters[\"lastKnownValue\"]\ncheckKeyPermission(key)\n- val valueFromListener = arrayOfNulls<String>(1)\n- val lock = Object()\nval listener = object : IKeyListener {\n- override fun changed(key: String?, newValue: String?) {\n- synchronized(lock) {\n- valueFromListener[0] = newValue\n- lock.notifyAll()\n+ override fun changed(key_: String, newValue: String?) {\n+ launch {\n+ if (!call.response.isCommitted) respondValue(key, newValue)\n}\n}\n}\n@@ -156,26 +155,19 @@ class KtorModelServer(val storeClient: IStoreClient) {\n// Registering the listener without needing it is less\n// likely to happen.\nval value = storeClient[key]\n- valueFromListener[0] = value\nif (value != lastKnownValue) {\n- respondValue(key, value)\n+ if (!call.response.isCommitted) respondValue(key, value)\nreturn@get\n}\n}\n- try {\n- synchronized(lock) {\n- // Long polling. The request returns when the value\n- // changes.\n- // Then the client will do a new request.\n- lock.wait(25000L)\n- }\n- } catch (e: InterruptedException) {\n- throw RuntimeException(e)\n+ for (i in 1..250) {\n+ if (call.response.isCommitted) break\n+ delay(100L)\n}\n} finally {\nstoreClient.removeListener(key, listener)\n}\n- respondValue(key, valueFromListener[0])\n+ if (!call.response.isCommitted) respondValue(key, storeClient[key])\n}\nget(\"/generateToken\") {\n"
},
{
"change_type": "MODIFY",
"old_path": "model-server/src/test/java/org/modelix/model/server/CachingStoreClientTest.java",
"new_path": "model-server/src/test/java/org/modelix/model/server/CachingStoreClientTest.java",
"diff": "@@ -20,6 +20,8 @@ import java.util.LinkedList;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\n+\n+import org.jetbrains.annotations.NotNull;\nimport org.junit.Assert;\nimport org.junit.Test;\n@@ -60,12 +62,12 @@ public class CachingStoreClientTest {\n}\n@Override\n- public void listen(String key, IKeyListener listener) {\n+ public void listen(@NotNull String key, @NotNull IKeyListener listener) {\nthrow new UnsupportedOperationException();\n}\n@Override\n- public void removeListener(String key, IKeyListener listener) {\n+ public void removeListener(@NotNull String key, @NotNull IKeyListener listener) {\nthrow new UnsupportedOperationException();\n}\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | fixed /poll/{key} |
426,496 | 10.06.2022 14:12:45 | -7,200 | 13ba74d278218314a0ebe1f247d9d40209428a81 | The model server didn't provide a 'repositoryId' | [
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/kotlin/org/modelix/model/server/KtorModelServer.kt",
"new_path": "model-server/src/main/kotlin/org/modelix/model/server/KtorModelServer.kt",
"diff": "@@ -51,7 +51,7 @@ class KtorModelServer(val storeClient: IStoreClient) {\nval HASH_PATTERN = Pattern.compile(\"[a-zA-Z0-9\\\\-_]{5}\\\\*[a-zA-Z0-9\\\\-_]{38}\")\nconst val PROTECTED_PREFIX = \"$$$\"\nval HEALTH_KEY = PROTECTED_PREFIX + \"health2\"\n- private const val REPOSITORY_ID_KEY = \"repositoryId\"\n+ private const val SERVER_ID_KEY = \"repositoryId\"\nprivate const val TEXT_PLAIN = \"text/plain\"\nprivate fun parseXForwardedFor(value: String?): List<InetAddress> {\nval result: List<InetAddress> = ArrayList()\n@@ -95,6 +95,9 @@ class KtorModelServer(val storeClient: IStoreClient) {\n}\nfun init(application: Application) {\n+ if (storeClient.get(SERVER_ID_KEY) == null) {\n+ storeClient.put(SERVER_ID_KEY, randomUUID());\n+ }\napplication.apply {\nmodelServerModule()\n}\n@@ -126,7 +129,7 @@ class KtorModelServer(val storeClient: IStoreClient) {\ncheckAuthorization()\nval key = call.parameters[\"key\"]!!\n- checkKeyPermission(key)\n+ checkKeyPermission(key, EPermissionType.READ)\nval value = storeClient[key]\nrespondValue(key, value)\n}\n@@ -135,7 +138,7 @@ class KtorModelServer(val storeClient: IStoreClient) {\ncheckAuthorization()\nval key: String = call.parameters[\"key\"]!!\nval lastKnownValue = call.request.queryParameters[\"lastKnownValue\"]\n- checkKeyPermission(key)\n+ checkKeyPermission(key, EPermissionType.READ)\nval listener = object : IKeyListener {\noverride fun changed(key_: String, newValue: String?) {\nlaunch {\n@@ -203,7 +206,7 @@ class KtorModelServer(val storeClient: IStoreClient) {\npost(\"/counter/{key}\") {\ncheckAuthorization()\nval key = call.parameters[\"key\"]!!\n- checkKeyPermission(key)\n+ checkKeyPermission(key, EPermissionType.WRITE)\nval value = storeClient.generateId(key)\ncall.respondText(text = value.toString())\n}\n@@ -256,7 +259,7 @@ class KtorModelServer(val storeClient: IStoreClient) {\nval keys: MutableList<String> = ArrayList(reqJson.length())\nfor (entry_ in reqJson) {\nval key = entry_ as String\n- checkKeyPermission(key)\n+ checkKeyPermission(key, EPermissionType.READ)\nkeys.add(key)\n}\nval values = storeClient.getAll(keys)\n@@ -353,10 +356,10 @@ class KtorModelServer(val storeClient: IStoreClient) {\nprotected fun putEntries(newEntries: Map<String, String?>) {\nval referencedKeys: MutableSet<String> = HashSet()\nfor ((key, value) in newEntries) {\n- if (REPOSITORY_ID_KEY == key) {\n+ if (SERVER_ID_KEY == key) {\nthrow NoPermissionException(\"Changing '$key' is not allowed\")\n}\n- checkKeyPermission(key)\n+ checkKeyPermission(key, EPermissionType.WRITE)\nif (value != null) {\nval matcher = HASH_PATTERN.matcher(value)\nwhile (matcher.find()) {\n@@ -396,10 +399,13 @@ class KtorModelServer(val storeClient: IStoreClient) {\n}\n@Throws(IOException::class)\n- private fun checkKeyPermission(key: String) {\n+ private fun checkKeyPermission(key: String, type: EPermissionType) {\nif (key.startsWith(PROTECTED_PREFIX)) {\nthrow NoPermissionException(\"Access to keys starting with '$PROTECTED_PREFIX' is only permitted to the model server itself.\")\n}\n+ if (key == SERVER_ID_KEY && type.includes(EPermissionType.WRITE)) {\n+ throw NoPermissionException(\"'$SERVER_ID_KEY' is read-only.\")\n+ }\n}\nprivate fun PipelineContext<Unit, ApplicationCall>.isValidAuthorization(): Boolean {\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | The model server didn't provide a 'repositoryId' |
426,496 | 10.06.2022 14:39:27 | -7,200 | cc5f493f6f3a82fe211ef4aeead151b95ac48382 | Renamed 'repositoryId' to 'server-id' | [
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/kotlin/org/modelix/model/server/KtorModelServer.kt",
"new_path": "model-server/src/main/kotlin/org/modelix/model/server/KtorModelServer.kt",
"diff": "@@ -51,7 +51,8 @@ class KtorModelServer(val storeClient: IStoreClient) {\nval HASH_PATTERN = Pattern.compile(\"[a-zA-Z0-9\\\\-_]{5}\\\\*[a-zA-Z0-9\\\\-_]{38}\")\nconst val PROTECTED_PREFIX = \"$$$\"\nval HEALTH_KEY = PROTECTED_PREFIX + \"health2\"\n- private const val SERVER_ID_KEY = \"repositoryId\"\n+ private const val LEGACY_SERVER_ID_KEY = \"repositoryId\"\n+ private const val SERVER_ID_KEY = \"server-id\"\nprivate const val TEXT_PLAIN = \"text/plain\"\nprivate fun parseXForwardedFor(value: String?): List<InetAddress> {\nval result: List<InetAddress> = ArrayList()\n@@ -95,8 +96,11 @@ class KtorModelServer(val storeClient: IStoreClient) {\n}\nfun init(application: Application) {\n- if (storeClient.get(SERVER_ID_KEY) == null) {\n- storeClient.put(SERVER_ID_KEY, randomUUID());\n+ var serverId = storeClient.get(SERVER_ID_KEY)\n+ if (serverId == null) {\n+ serverId = storeClient.get(LEGACY_SERVER_ID_KEY) ?: randomUUID()\n+ storeClient.put(SERVER_ID_KEY, serverId)\n+ storeClient.put(LEGACY_SERVER_ID_KEY, serverId)\n}\napplication.apply {\nmodelServerModule()\n@@ -403,8 +407,8 @@ class KtorModelServer(val storeClient: IStoreClient) {\nif (key.startsWith(PROTECTED_PREFIX)) {\nthrow NoPermissionException(\"Access to keys starting with '$PROTECTED_PREFIX' is only permitted to the model server itself.\")\n}\n- if (key == SERVER_ID_KEY && type.includes(EPermissionType.WRITE)) {\n- throw NoPermissionException(\"'$SERVER_ID_KEY' is read-only.\")\n+ if ((key == SERVER_ID_KEY || key == LEGACY_SERVER_ID_KEY) && type.includes(EPermissionType.WRITE)) {\n+ throw NoPermissionException(\"'$key' is read-only.\")\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "mps/org.modelix.model.mpsplugin/models/org.modelix.model.mpsplugin.mps",
"new_path": "mps/org.modelix.model.mpsplugin/models/org.modelix.model.mpsplugin.mps",
"diff": "<node concept=\"liA8E\" id=\"4rrX99oe8SP\" role=\"2OqNvi\">\n<ref role=\"37wK5l\" to=\"5440:~RestWebModelClient.get(java.lang.String)\" resolve=\"get\" />\n<node concept=\"Xl_RD\" id=\"4rrX99oe9b6\" role=\"37wK5m\">\n+ <property role=\"Xl_RC\" value=\"server-id\" />\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ <node concept=\"3clFbJ\" id=\"3rHQwNUC7Z7\" role=\"3cqZAp\">\n+ <node concept=\"3clFbS\" id=\"3rHQwNUC7Z9\" role=\"3clFbx\">\n+ <node concept=\"3SKdUt\" id=\"3rHQwNUCjqN\" role=\"3cqZAp\">\n+ <node concept=\"1PaTwC\" id=\"3rHQwNUCjqO\" role=\"1aUNEU\">\n+ <node concept=\"3oM_SD\" id=\"3rHQwNUCjqP\" role=\"1PaTwD\">\n+ <property role=\"3oM_SC\" value=\"TODO\" />\n+ </node>\n+ <node concept=\"3oM_SD\" id=\"3rHQwNUCkno\" role=\"1PaTwD\">\n+ <property role=\"3oM_SC\" value=\"'repositoryId'\" />\n+ </node>\n+ <node concept=\"3oM_SD\" id=\"3rHQwNUCtxv\" role=\"1PaTwD\">\n+ <property role=\"3oM_SC\" value=\"was\" />\n+ </node>\n+ <node concept=\"3oM_SD\" id=\"3rHQwNUCtJy\" role=\"1PaTwD\">\n+ <property role=\"3oM_SC\" value=\"renamed\" />\n+ </node>\n+ <node concept=\"3oM_SD\" id=\"3rHQwNUCu5V\" role=\"1PaTwD\">\n+ <property role=\"3oM_SC\" value=\"to\" />\n+ </node>\n+ <node concept=\"3oM_SD\" id=\"3rHQwNUCu6a\" role=\"1PaTwD\">\n+ <property role=\"3oM_SC\" value=\"'server-id'.\" />\n+ </node>\n+ <node concept=\"3oM_SD\" id=\"3rHQwNUCryS\" role=\"1PaTwD\">\n+ <property role=\"3oM_SC\" value=\"After\" />\n+ </node>\n+ <node concept=\"3oM_SD\" id=\"3rHQwNUCvwW\" role=\"1PaTwD\">\n+ <property role=\"3oM_SC\" value=\"migrating\" />\n+ </node>\n+ <node concept=\"3oM_SD\" id=\"3rHQwNUCvxd\" role=\"1PaTwD\">\n+ <property role=\"3oM_SC\" value=\"all\" />\n+ </node>\n+ <node concept=\"3oM_SD\" id=\"3rHQwNUCvZE\" role=\"1PaTwD\">\n+ <property role=\"3oM_SC\" value=\"servers\" />\n+ </node>\n+ <node concept=\"3oM_SD\" id=\"3rHQwNUCwWC\" role=\"1PaTwD\">\n+ <property role=\"3oM_SC\" value=\"this\" />\n+ </node>\n+ <node concept=\"3oM_SD\" id=\"3rHQwNUCxCY\" role=\"1PaTwD\">\n+ <property role=\"3oM_SC\" value=\"request\" />\n+ </node>\n+ <node concept=\"3oM_SD\" id=\"3rHQwNUCz3Q\" role=\"1PaTwD\">\n+ <property role=\"3oM_SC\" value=\"is\" />\n+ </node>\n+ <node concept=\"3oM_SD\" id=\"3rHQwNUCzUz\" role=\"1PaTwD\">\n+ <property role=\"3oM_SC\" value=\"not\" />\n+ </node>\n+ <node concept=\"3oM_SD\" id=\"3rHQwNUCzUV\" role=\"1PaTwD\">\n+ <property role=\"3oM_SC\" value=\"required\" />\n+ </node>\n+ <node concept=\"3oM_SD\" id=\"3rHQwNUC_0v\" role=\"1PaTwD\">\n+ <property role=\"3oM_SC\" value=\"anymore.\" />\n+ </node>\n+ </node>\n+ </node>\n+ <node concept=\"3clFbF\" id=\"3rHQwNUCd2V\" role=\"3cqZAp\">\n+ <node concept=\"37vLTI\" id=\"3rHQwNUCei8\" role=\"3clFbG\">\n+ <node concept=\"2OqwBi\" id=\"3rHQwNUCfOM\" role=\"37vLTx\">\n+ <node concept=\"37vLTw\" id=\"3rHQwNUCeXY\" role=\"2Oq$k0\">\n+ <ref role=\"3cqZAo\" node=\"6aRQr1WVnku\" resolve=\"client\" />\n+ </node>\n+ <node concept=\"liA8E\" id=\"3rHQwNUCgVe\" role=\"2OqNvi\">\n+ <ref role=\"37wK5l\" to=\"5440:~RestWebModelClient.get(java.lang.String)\" resolve=\"get\" />\n+ <node concept=\"Xl_RD\" id=\"3rHQwNUCh_X\" role=\"37wK5m\">\n<property role=\"Xl_RC\" value=\"repositoryId\" />\n</node>\n</node>\n</node>\n+ <node concept=\"37vLTw\" id=\"3rHQwNUCd2T\" role=\"37vLTJ\">\n+ <ref role=\"3cqZAo\" node=\"4rrX99oe4RD\" resolve=\"id\" />\n+ </node>\n+ </node>\n+ </node>\n+ </node>\n+ <node concept=\"2OqwBi\" id=\"3rHQwNUC9Fo\" role=\"3clFbw\">\n+ <node concept=\"37vLTw\" id=\"3rHQwNUC8E8\" role=\"2Oq$k0\">\n+ <ref role=\"3cqZAo\" node=\"4rrX99oe4RD\" resolve=\"id\" />\n+ </node>\n+ <node concept=\"17RlXB\" id=\"3rHQwNUCckx\" role=\"2OqNvi\" />\n</node>\n</node>\n<node concept=\"3clFbJ\" id=\"4rrX99oec0P\" role=\"3cqZAp\">\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Renamed 'repositoryId' to 'server-id' |
426,496 | 10.06.2022 15:12:07 | -7,200 | b163ac1a07e55dbfc9946014b45f90c69ed9e1aa | Permission check for entries on the model server | [
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/kotlin/org/modelix/model/server/KtorModelServer.kt",
"new_path": "model-server/src/main/kotlin/org/modelix/model/server/KtorModelServer.kt",
"diff": "@@ -17,6 +17,7 @@ package org.modelix.model.server\nimport io.ktor.server.application.*\nimport io.ktor.server.plugins.cors.routing.*\nimport io.ktor.http.*\n+import io.ktor.server.auth.*\nimport io.ktor.server.plugins.*\nimport io.ktor.server.plugins.forwardedheaders.*\nimport io.ktor.server.request.*\n@@ -30,6 +31,7 @@ import org.json.JSONObject\nimport org.modelix.authorization.*\nimport org.modelix.authorization.ktor.installAuthentication\nimport org.modelix.authorization.ktor.requiresPermission\n+import org.modelix.model.persistent.HashUtil\nimport org.slf4j.LoggerFactory\nimport java.io.IOException\nimport java.net.InetAddress\n@@ -45,6 +47,9 @@ private fun toLong(value: String?): Long {\nprivate class NotFoundException(description: String?) : RuntimeException(description)\n+private typealias CallContext = PipelineContext<Unit, ApplicationCall>\n+private fun CallContext.getUser() = call.principal<AuthenticatedUser>() ?: AuthenticatedUser.ANONYMOUS_USER\n+\nclass KtorModelServer(val storeClient: IStoreClient) {\ncompanion object {\nprivate val LOG = LoggerFactory.getLogger(KtorModelServer::class.java)\n@@ -357,7 +362,7 @@ class KtorModelServer(val storeClient: IStoreClient) {\nreturn result\n}\n- protected fun putEntries(newEntries: Map<String, String?>) {\n+ protected fun CallContext.putEntries(newEntries: Map<String, String?>) {\nval referencedKeys: MutableSet<String> = HashSet()\nfor ((key, value) in newEntries) {\nif (SERVER_ID_KEY == key) {\n@@ -396,20 +401,27 @@ class KtorModelServer(val storeClient: IStoreClient) {\n}\n@Throws(IOException::class)\n- private fun PipelineContext<Unit, ApplicationCall>.checkAuthorization() {\n+ private fun CallContext.checkAuthorization() {\nif (!isValidAuthorization()) {\nthrow NoPermissionException(\"Not authorized.\")\n}\n}\n@Throws(IOException::class)\n- private fun checkKeyPermission(key: String, type: EPermissionType) {\n+ private fun CallContext.checkKeyPermission(key: String, type: EPermissionType) {\nif (key.startsWith(PROTECTED_PREFIX)) {\nthrow NoPermissionException(\"Access to keys starting with '$PROTECTED_PREFIX' is only permitted to the model server itself.\")\n}\nif ((key == SERVER_ID_KEY || key == LEGACY_SERVER_ID_KEY) && type.includes(EPermissionType.WRITE)) {\nthrow NoPermissionException(\"'$key' is read-only.\")\n}\n+ if (HashUtil.isSha256(key)) {\n+ // Reading entries with a hash key is equivalent to uncompressing data that the user already has access to.\n+ // If he isn't allowed to read the entry then he shouldn't be allowed to know the hash.\n+ // A permission check has happened somewhere earlier.\n+ return\n+ }\n+ ModelixAuthorization.checkPermission(getUser(), PermissionId(\"model-server-entry/$key\"), type)\n}\nprivate fun PipelineContext<Unit, ApplicationCall>.isValidAuthorization(): Boolean {\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Permission check for entries on the model server |
426,496 | 10.06.2022 15:53:46 | -7,200 | 699a3784237b6793f176d87191e892ed866ed57d | By default everything is public | [
{
"change_type": "MODIFY",
"old_path": "authorization/src/main/kotlin/org/modelix/authorization/ModelixAuthorization.kt",
"new_path": "authorization/src/main/kotlin/org/modelix/authorization/ModelixAuthorization.kt",
"diff": "@@ -51,9 +51,18 @@ object ModelixAuthorization {\npersistence.storeData(data)\n}\n- fun getPermissions(user: AuthenticatedUser, permissionId: PermissionId): Set<EPermissionType> {\n+ fun getPermissions(user: AuthenticatedUser, permissionId: PermissionId, publicIfNew: Boolean = false): Set<EPermissionType> {\nval userAndGroupIds = user.getUserAndGroupIds() + AuthenticatedUser.PUBLIC_GROUP\n- val data = getData()\n+ var data = getData()\n+ if (publicIfNew && !data.knownPermissions.contains(permissionId) && !data.getAllKnownPermissions().contains(permissionId)) {\n+ data = AuthorizationData(\n+ data.knownUsers,\n+ data.knownGroups,\n+ data.knownPermissions + permissionId,\n+ data.grantedPermissions + PermissionData(AuthenticatedUser.PUBLIC_GROUP, permissionId, EPermissionType.WRITE)\n+ )\n+ storeData(data)\n+ }\nval result = data.grantedPermissions\n.filter { it.permissionId == permissionId && userAndGroupIds.contains(it.userOrGroupId) }\n.map { it.type }.toSet()\n@@ -68,8 +77,8 @@ object ModelixAuthorization {\nreturn result\n}\n- fun hasPermission(user: AuthenticatedUser, permissionId: PermissionId, type: EPermissionType): Boolean {\n- val result = getPermissions(user, permissionId).any { it.includes(type) }\n+ fun hasPermission(user: AuthenticatedUser, permissionId: PermissionId, type: EPermissionType, publicIfNew: Boolean = false): Boolean {\n+ val result = getPermissions(user, permissionId, publicIfNew).any { it.includes(type) }\nif (permissionId == AUTHORIZATION_DATA_PERMISSION && !result) {\nif (!getData().grantedPermissions.any { it.permissionId == permissionId && it.type.includes(EPermissionType.WRITE) }) {\n// if nobody has the permission to edit permissions we would have a problem\n@@ -79,8 +88,8 @@ object ModelixAuthorization {\nreturn result\n}\n- fun checkPermission(user: AuthenticatedUser, permissionId: PermissionId, type: EPermissionType) {\n- if (!hasPermission(user, permissionId, type)) {\n+ fun checkPermission(user: AuthenticatedUser, permissionId: PermissionId, type: EPermissionType, publicIfNew: Boolean = false) {\n+ if (!hasPermission(user, permissionId, type, publicIfNew)) {\nthrow NoPermissionException(user, permissionId, type)\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/kotlin/org/modelix/model/server/KtorModelServer.kt",
"new_path": "model-server/src/main/kotlin/org/modelix/model/server/KtorModelServer.kt",
"diff": "@@ -365,9 +365,6 @@ class KtorModelServer(val storeClient: IStoreClient) {\nprotected fun CallContext.putEntries(newEntries: Map<String, String?>) {\nval referencedKeys: MutableSet<String> = HashSet()\nfor ((key, value) in newEntries) {\n- if (SERVER_ID_KEY == key) {\n- throw NoPermissionException(\"Changing '$key' is not allowed\")\n- }\ncheckKeyPermission(key, EPermissionType.WRITE)\nif (value != null) {\nval matcher = HASH_PATTERN.matcher(value)\n@@ -421,7 +418,7 @@ class KtorModelServer(val storeClient: IStoreClient) {\n// A permission check has happened somewhere earlier.\nreturn\n}\n- ModelixAuthorization.checkPermission(getUser(), PermissionId(\"model-server-entry/$key\"), type)\n+ ModelixAuthorization.checkPermission(getUser(), PermissionId(\"model-server-entry/$key\"), type, publicIfNew = true)\n}\nprivate fun PipelineContext<Unit, ApplicationCall>.isValidAuthorization(): Boolean {\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | By default everything is public |
426,496 | 13.06.2022 10:04:56 | -7,200 | d776b597dac690b6da2cf0233d7ff135e2749545 | Tested the deployment and updated the documentation | [
{
"change_type": "MODIFY",
"old_path": "authorization-ui/src/main/kotlin/org/modelix/authorization/ui/AuthorizationModule.kt",
"new_path": "authorization-ui/src/main/kotlin/org/modelix/authorization/ui/AuthorizationModule.kt",
"diff": "@@ -35,6 +35,20 @@ fun Application.authorizationModule() {\ninstallAuthentication()\nrouting {\n+ authorizationRouting()\n+ }\n+\n+ install(CORS) {\n+ anyHost()\n+ allowHeader(HttpHeaders.ContentType)\n+ allowMethod(HttpMethod.Options)\n+ allowMethod(HttpMethod.Get)\n+ allowMethod(HttpMethod.Put)\n+ allowMethod(HttpMethod.Post)\n+ }\n+}\n+\n+fun Route.authorizationRouting() {\nrequiresPermission(ModelixAuthorization.AUTHORIZATION_DATA_PERMISSION, EPermissionType.READ) {\nget(\"/\") {\nval data = ModelixAuthorization.getData()\n@@ -244,13 +258,3 @@ fun Application.authorizationModule() {\n}\n}\n}\n\\ No newline at end of file\n-\n- install(CORS) {\n- anyHost()\n- allowHeader(HttpHeaders.ContentType)\n- allowMethod(HttpMethod.Options)\n- allowMethod(HttpMethod.Get)\n- allowMethod(HttpMethod.Put)\n- allowMethod(HttpMethod.Post)\n- }\n-}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "build-and-deploy.sh",
"diff": "+#!/bin/sh\n+\n+set -e\n+\n+rm -f modelix.version\n+\n+./gradlew :clean :assemble\n+./docker-build-all.sh\n+./kubernetes-secrets.sh\n+./kubernetes-apply-modelserver.sh\n+./kubernetes-apply-workspaces.sh\n+\n+# If pod/db-... remains is status Pending ensure that at least one volume exists in docker desktop\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "build.gradle",
"new_path": "build.gradle",
"diff": "@@ -35,9 +35,9 @@ buildscript {\nplugins {\nid \"com.diffplug.gradle.spotless\" version \"4.5.1\" apply false\n- id \"org.jetbrains.kotlin.jvm\" version \"1.6.10\" apply false\n- id \"org.jetbrains.kotlin.multiplatform\" version \"1.6.10\" apply false\n- id \"org.jetbrains.kotlin.plugin.serialization\" version \"1.6.10\" apply false\n+ id \"org.jetbrains.kotlin.jvm\" version \"1.6.21\" apply false\n+ id \"org.jetbrains.kotlin.multiplatform\" version \"1.6.21\" apply false\n+ id \"org.jetbrains.kotlin.plugin.serialization\" version \"1.6.21\" apply false\nid \"maven-publish\"\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "doc/running-modelix.md",
"new_path": "doc/running-modelix.md",
"diff": "@@ -26,6 +26,15 @@ Otherwise, MPS (the JBR) will not use the correct memory limit.\n- `./docker-build-model.sh`\n- `./kubernetes-apply-modelserver.sh`\n+## Workspaces\n+\n+Workspaces allow you to run your MPS projects in the kubernetes cluster.\n+\n+- In docker desktop ensure that at least one volume exists (Dashboard > Volumes)\n+- `./build-and-deploy.sh`\n+- `./kubernetes-open-workspaces.sh`\n+- Add a new workspace and configure your project and its dependencies.\n+\n## Web Editor\nThe web editor is an MPS plugin that requires a running MPS instance.\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "kubernetes-apply-workspaces.sh",
"diff": "+#!/bin/sh\n+\n+kubectl apply \\\n+ -f kubernetes/common/uiproxy-serviceaccount.yaml \\\n+ -f kubernetes/common/uiproxy-rolebinding.yaml \\\n+ -f kubernetes/common/instances-manager-deployment.yaml \\\n+ -f kubernetes/common/instances-manager-service.yaml \\\n+ -f kubernetes/common/workspace-client-deployment.yaml \\\n+ -f kubernetes/common/workspace-client-service.yaml \\\n+ -f kubernetes/common/workspace-uploads-persistentvolumeclaim.yaml \\\n+ -f kubernetes/common/workspace-manager-deployment.yaml \\\n+ -f kubernetes/common/workspace-manager-service.yaml\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "kubernetes-open-workspaces.sh",
"diff": "+#!/bin/sh\n+\n+SERVICEPORT=$(kubectl get service/proxy | sed -n \"s/.*80:\\([0-9]*\\)\\/TCP.*/\\1/p\")\n+open \"http://localhost:${SERVICEPORT}/workspace-manager/\"\n"
},
{
"change_type": "MODIFY",
"old_path": "kubernetes/local/db-data-persistentvolumeclaim.yaml",
"new_path": "kubernetes/local/db-data-persistentvolumeclaim.yaml",
"diff": "apiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n- creationTimestamp: null\nlabels:\napp: db-data\nname: db-data\n@@ -11,4 +10,3 @@ spec:\nresources:\nrequests:\nstorage: 3000Mi\n-status: {}\n"
},
{
"change_type": "MODIFY",
"old_path": "model-server/build.gradle.kts",
"new_path": "model-server/build.gradle.kts",
"diff": "import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar\nplugins {\n- java\napplication\nid(\"com.diffplug.gradle.spotless\")\n`maven-publish`\n@@ -43,6 +42,7 @@ dependencies {\nimplementation(\"io.ktor:ktor-server-status-pages:$ktorVersion\")\nimplementation(\"io.ktor:ktor-server-forwarded-header:$ktorVersion\")\nimplementation(project(\":authorization\"))\n+ implementation(project(\":authorization-ui\"))\nval igniteVersion = \"2.13.0\"\nimplementation(\"org.apache.ignite:ignite-core:$igniteVersion\")\n"
},
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/kotlin/org/modelix/model/server/KtorModelServer.kt",
"new_path": "model-server/src/main/kotlin/org/modelix/model/server/KtorModelServer.kt",
"diff": "@@ -119,9 +119,6 @@ class KtorModelServer(val storeClient: IStoreClient) {\ninstall(ForwardedHeaders)\nrouting {\n- get(\"/\") {\n- call.respondText(\"Model Server\")\n- }\nget(\"/health\") {\nif (isHealthy()) {\ncall.respondText(text = \"healthy\", contentType = ContentType.Text.Plain, status = HttpStatusCode.OK)\n"
},
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/kotlin/org/modelix/model/server/Main.kt",
"new_path": "model-server/src/main/kotlin/org/modelix/model/server/Main.kt",
"diff": "@@ -19,8 +19,14 @@ import com.beust.jcommander.Parameter\nimport com.beust.jcommander.converters.BooleanConverter\nimport com.beust.jcommander.converters.IntegerConverter\nimport com.beust.jcommander.converters.StringConverter\n+import io.ktor.server.application.*\nimport io.ktor.server.engine.*\n+import io.ktor.server.html.*\nimport io.ktor.server.netty.*\n+import io.ktor.server.response.*\n+import io.ktor.server.routing.*\n+import kotlinx.html.*\n+import org.modelix.authorization.ui.*\nimport org.apache.commons.io.FileUtils\nimport org.apache.ignite.Ignition\nimport org.modelix.authorization.ModelixAuthorization\n@@ -239,6 +245,28 @@ object Main {\nval ktorServer: NettyApplicationEngine = embeddedServer(Netty, port = port) {\nmodelServer.init(this)\nhistoryHandler.init(this)\n+ routing {\n+ get(\"/\") {\n+ call.respondHtml {\n+ body {\n+ div { +\"Model Server\" }\n+ br {}\n+ ul {\n+ li {\n+ a(\"authorization/\") { +\"Manage Permissions\" }\n+ }\n+ li {\n+ a(\"history/\") { +\"Model History\" }\n+ }\n+ }\n+ }\n+ }\n+ call.respondText(\"Model Server\")\n+ }\n+ route(\"/authorization\") {\n+ authorizationRouting()\n+ }\n+ }\n}\nktorServer.start(wait = true)\nLOG.info(\"Server started\")\n"
},
{
"change_type": "MODIFY",
"old_path": "workspace-client/build.gradle.kts",
"new_path": "workspace-client/build.gradle.kts",
"diff": "@@ -3,7 +3,7 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar\ndescription = \"Downloads modules from a workspace before starting MPS\"\nval ktorVersion = \"1.6.7\"\nval kotlinCoroutinesVersion = \"1.6.0\"\n-val kotlinVersion = \"1.6.10\"\n+val kotlinVersion = \"1.6.21\"\nval logbackVersion = \"1.2.1\"\nplugins {\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Tested the deployment and updated the documentation |
426,496 | 13.06.2022 10:21:12 | -7,200 | ff315a5a4e16859bcf969bad4bf6900c87fcbf7e | Cache for authorization data | [
{
"change_type": "MODIFY",
"old_path": "authorization/src/main/kotlin/org/modelix/authorization/ModelServerAuthorizationPersistence.kt",
"new_path": "authorization/src/main/kotlin/org/modelix/authorization/ModelServerAuthorizationPersistence.kt",
"diff": "@@ -16,6 +16,7 @@ package org.modelix.authorization\nimport kotlinx.serialization.decodeFromString\nimport kotlinx.serialization.encodeToString\nimport kotlinx.serialization.json.Json\n+import org.modelix.model.IKeyListener\nimport org.modelix.model.client.IModelClient\nimport org.modelix.model.client.RestWebModelClient\n@@ -28,18 +29,49 @@ private fun getModelServerUrl(): String {\nclass ModelServerAuthorizationPersistence(val client: IModelClient, val dataKey: String) : IAuthorizationPersistence {\n+ private var listener: IKeyListener? = null\n+ private var cachedData: AuthorizationData? = null\n+\nconstructor(modelServerUrl: String?, dataKey: String)\n: this(RestWebModelClient(modelServerUrl ?: getModelServerUrl()), dataKey)\nconstructor() : this(null, \"authorization-data\")\nconstructor(client: IModelClient) : this(client, \"authorization-data\")\n+ @Synchronized\n+ private fun registerListener() {\n+ var l = listener\n+ if (l == null) {\n+ l = object : IKeyListener {\n+ override fun changed(key: String, value: String?) {\n+ if (value == null) return\n+ cachedData = Json.decodeFromString<AuthorizationData>(value)\n+ }\n+ }\n+ listener = l\n+ client.listen(dataKey, l)\n+ }\n+ }\n+\noverride fun loadData(): AuthorizationData? {\n+ registerListener()\n+ if (cachedData != null) {\n+ return cachedData\n+ }\nval serialized = client.get(dataKey) ?: return null\n- return Json.decodeFromString<AuthorizationData>(serialized)\n+ val data = Json.decodeFromString<AuthorizationData>(serialized)\n+ this.cachedData = data\n+ return data\n}\noverride fun storeData(data: AuthorizationData) {\n+ this.cachedData = data\nclient.put(dataKey, Json.encodeToString(data))\n}\n+\n+ @Synchronized\n+ fun dispose() {\n+ listener?.let { client.removeListener(dataKey, it) }\n+ listener = null\n+ }\n}\n\\ No newline at end of file\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Cache for authorization data |
426,496 | 14.06.2022 10:58:19 | -7,200 | 30fbcc0a01fbbc70d9006f488016fb3990dae416 | New high level model REST API
It's intended to be used by JavaScript client such as angular applications.
It doesn't require the model client and returns JSON.
It provides the same consistency guarantees by running the model-client on the server side. | [
{
"change_type": "MODIFY",
"old_path": "model-server/build.gradle.kts",
"new_path": "model-server/build.gradle.kts",
"diff": "@@ -7,6 +7,7 @@ plugins {\nid(\"com.adarshr.test-logger\") version \"2.1.0\"\nid(\"org.jetbrains.kotlin.jvm\")\nid(\"com.github.johnrengelman.shadow\") version \"6.1.0\"\n+ kotlin(\"plugin.serialization\")\n}\ndescription = \"Model Server offering access to model storage\"\n@@ -22,9 +23,11 @@ val mpsExtensionsVersion: String by project\nval kotlinVersion: String by project\ndependencies {\n+ implementation(\"org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion\")\n+ implementation(\"org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2\")\n+\nimplementation(\"org.modelix:model-api:$mpsExtensionsVersion\")\nimplementation(project(\":model-client\", configuration = \"jvmRuntimeElements\"))\n- implementation(\"org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion\")\nimplementation(\"org.apache.commons:commons-lang3:3.10\")\nimplementation(\"org.json:json:20200518\")\n@@ -51,13 +54,6 @@ dependencies {\nimplementation(\"org.postgresql:postgresql:42.3.3\")\n- val jettyVersion = \"9.4.43.v20210629\"\n- implementation(\"org.eclipse.jetty:jetty-server:$jettyVersion\")\n- implementation(\"org.eclipse.jetty.websocket:websocket-servlet:$jettyVersion\")\n- implementation(\"org.eclipse.jetty:jetty-servlet:$jettyVersion\")\n- implementation(\"org.eclipse.jetty.websocket:websocket-server:$jettyVersion\")\n- implementation(\"org.eclipse.jetty:jetty-servlets:$jettyVersion\")\n-\nimplementation(\"commons-io:commons-io:2.7\")\nimplementation(\"com.google.guava:guava:30.0-jre\")\nimplementation(\"com.beust:jcommander:1.7\")\n@@ -66,6 +62,9 @@ dependencies {\ntestImplementation(\"junit:junit:4.13.1\")\ntestImplementation(\"io.cucumber:cucumber-java:6.2.2\")\n+ testImplementation(\"io.ktor:ktor-server-test-host:$ktorVersion\")\n+ testImplementation(\"org.jetbrains.kotlin:kotlin-test:$kotlinVersion\")\n+ implementation(kotlin(\"test-junit\"))\n}\nval cucumberRuntime by configurations.creating {\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "model-server/src/main/kotlin/org/modelix/model/server/JsonModelServer.kt",
"diff": "+/*\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.modelix.model.server\n+\n+import io.ktor.http.*\n+import io.ktor.server.application.*\n+import io.ktor.server.auth.*\n+import io.ktor.server.response.*\n+import io.ktor.server.routing.*\n+import io.ktor.util.pipeline.*\n+import org.json.JSONObject\n+import org.modelix.authorization.AuthenticatedUser\n+import org.modelix.model.api.INode\n+import org.modelix.model.api.ITree\n+import org.modelix.model.api.PNodeAdapter\n+import org.modelix.model.api.TreePointer\n+import org.modelix.model.client.IModelClient\n+import org.modelix.model.lazy.CLTree\n+import org.modelix.model.lazy.CLVersion\n+import org.modelix.model.lazy.RepositoryId\n+import java.util.Date\n+\n+class JsonModelServer(val client: IModelClient) {\n+\n+ fun getStore() = client.storeCache!!\n+\n+ fun init(application: Application) {\n+ application.routing {\n+ route(\"/json\") {\n+ initRouting()\n+ }\n+ }\n+ }\n+\n+ private fun Route.initRouting() {\n+ get(\"/{repositoryId}/{versionHash}/\") {\n+ val versionHash = call.parameters[\"versionHash\"]!!\n+ // TODO 404 if it doesn't exist\n+ val version = CLVersion.loadFromHash(versionHash, getStore())\n+ respondVersion(version)\n+ }\n+ post(\"/{repositoryId}/init\") {\n+ // TODO error if it already exists\n+ val repositoryId = RepositoryId(call.parameters[\"repositoryId\"]!!)\n+ val newTree = CLTree(repositoryId, getStore())\n+ val userId = call.principal<AuthenticatedUser>()?.userIds?.firstOrNull()\n+ val newVersion = CLVersion.createRegularVersion(\n+ client.idGenerator.generate(),\n+ Date().toString(),\n+ userId,\n+ newTree,\n+ null,\n+ emptyArray()\n+ )\n+ client.asyncStore!!.put(repositoryId.getBranchKey(), newVersion.hash)\n+ respondVersion(newVersion)\n+ }\n+ }\n+\n+ private suspend fun CallContext.respondVersion(version: CLVersion) {\n+ val rootNode = PNodeAdapter(ITree.ROOT_ID, TreePointer(version.tree))\n+ val json = JSONObject()\n+ json.put(\"repositoryId\", version.tree.getId())\n+ json.put(\"versionHash\", version.hash)\n+ json.put(\"root\", node2json(rootNode))\n+ call.respondText(json.toString(2), ContentType.Application.Json)\n+ }\n+\n+ private fun node2json(node: INode): JSONObject {\n+ val json = JSONObject()\n+ if (node is PNodeAdapter) {\n+ json.put(\"modelixId\", node.nodeId)\n+ }\n+ for (role in node.getPropertyRoles()) {\n+ json.put(role, node.getPropertyValue(role))\n+ }\n+ for (role in node.getReferenceRoles()) {\n+ val target = node.getReferenceTarget(role)\n+ if (target is PNodeAdapter) {\n+ json.put(role, target.nodeId)\n+ }\n+ }\n+ for (children in node.allChildren.groupBy { it.roleInParent }) {\n+ json.put(children.key ?: \"null\", children.value.map { node2json(it) })\n+ }\n+ return json\n+ }\n+}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/kotlin/org/modelix/model/server/KtorModelServer.kt",
"new_path": "model-server/src/main/kotlin/org/modelix/model/server/KtorModelServer.kt",
"diff": "@@ -48,7 +48,7 @@ private fun toLong(value: String?): Long {\nprivate class NotFoundException(description: String?) : RuntimeException(description)\n-private typealias CallContext = PipelineContext<Unit, ApplicationCall>\n+typealias CallContext = PipelineContext<Unit, ApplicationCall>\nclass KtorModelServer(val storeClient: IStoreClient) {\ncompanion object {\n@@ -402,27 +402,7 @@ class KtorModelServer(val storeClient: IStoreClient) {\n//ModelixAuthorization.checkPermission(getUser(), PermissionId(\"model-server-entry/$key\"), type, publicIfNew = true)\n}\n- private fun CallContext.getUser(): AuthenticatedUser {\n- val principal = call.principal<AuthenticatedUser>()\n- if (principal != null) return principal\n- val token = extractToken(call)\n- if (!token.isNullOrEmpty()) {\n- if (token == sharedSecret) {\n- return AuthenticatedUser(setOf(\"cluster-internal\"), setOf(AuthenticatedUser.PUBLIC_GROUP))\n- } else {\n- val expires = storeClient[PROTECTED_PREFIX + \"_token_expires_\" + token]?.toLong() ?: 0L\n- if (System.currentTimeMillis() <= expires) {\n- val email = storeClient[PROTECTED_PREFIX + \"_token_email_\" + token]\n- if (!email.isNullOrEmpty()) {\n- return AuthenticatedUser(setOf(email), setOf(AuthenticatedUser.PUBLIC_GROUP))\n- }\n- }\n- }\n- }\n-\n- return AuthenticatedUser.ANONYMOUS_USER\n- }\nfun isHealthy(): Boolean {\nval value = toLong(storeClient[HEALTH_KEY]) + 1\n"
},
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/kotlin/org/modelix/model/server/LocalModelClient.kt",
"new_path": "model-server/src/main/kotlin/org/modelix/model/server/LocalModelClient.kt",
"diff": "@@ -71,8 +71,8 @@ class LocalModelClient(private val store: IStoreClient) : IModelClient {\nreturn 0\n}\n- override val storeCache: IDeserializingKeyValueStore?\n+ override val storeCache: IDeserializingKeyValueStore\nget() = objectCache\n- override val asyncStore: IKeyValueStore?\n+ override val asyncStore: IKeyValueStore\nget() = this\n}\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "model-server/src/test/kotlin/JsonAPITest.kt",
"diff": "+/*\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+import io.ktor.client.request.*\n+import io.ktor.client.statement.*\n+import io.ktor.http.*\n+import io.ktor.server.application.*\n+import io.ktor.server.testing.*\n+import org.json.JSONArray\n+import org.json.JSONObject\n+import org.modelix.model.server.InMemoryStoreClient\n+import org.modelix.model.server.JsonModelServer\n+import org.modelix.model.server.LocalModelClient\n+import kotlin.test.*\n+\n+class JsonAPITest {\n+ private fun runTest(block: suspend ApplicationTestBuilder.() -> Unit) = testApplication {\n+ application {\n+ JsonModelServer(LocalModelClient(InMemoryStoreClient())).init(this)\n+ }\n+ block()\n+ }\n+ val repoId = \"myrepo\"\n+\n+ @Test\n+ fun createNewRepo() = runTest {\n+ val response = client.post(\"/json/$repoId/init\")\n+ assertEquals(HttpStatusCode.OK, response.status)\n+ assertEmptyVersion(JSONObject(response.bodyAsText()))\n+ }\n+\n+ private fun assertEmptyVersion(json: JSONObject) {\n+ assertEquals(json.getJSONObject(\"root\").getLong(\"modelixId\"), 1L)\n+ assertEquals(json.getString(\"repositoryId\"), repoId)\n+ assertNotNull(json.optString(\"versionHash\"), \"versionHash missing\")\n+ }\n+\n+ @Test\n+ fun getByVersionHash() = runTest {\n+ val versionHash = JSONObject(client.post(\"/json/$repoId/init\").bodyAsText()).getString(\"versionHash\")\n+ val response = client.get(\"/json/$repoId/$versionHash/\")\n+ assertEquals(HttpStatusCode.OK, response.status)\n+ assertEmptyVersion(JSONObject(response.bodyAsText()))\n+ }\n+\n+\n+\n+}\n\\ No newline at end of file\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | New high level model REST API
It's intended to be used by JavaScript client such as angular applications.
It doesn't require the model client and returns JSON.
It provides the same consistency guarantees by running the model-client on the server side. |
426,496 | 14.06.2022 17:23:58 | -7,200 | c0d02f06354fa6c3d0f2c90148743c854048ddef | concurrent change | [
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/kotlin/org/modelix/model/server/JsonModelServer.kt",
"new_path": "model-server/src/main/kotlin/org/modelix/model/server/JsonModelServer.kt",
"diff": "@@ -22,9 +22,7 @@ import io.ktor.server.routing.*\nimport org.json.JSONArray\nimport org.json.JSONObject\nimport org.modelix.authorization.AuthenticatedUser\n-import org.modelix.model.VersionMerger\nimport org.modelix.model.api.*\n-import org.modelix.model.client.ActiveBranch\nimport org.modelix.model.client.IModelClient\nimport org.modelix.model.client.ReplicatedRepository\nimport org.modelix.model.lazy.CLTree\n@@ -46,6 +44,13 @@ class JsonModelServer(val client: IModelClient) {\n}\nprivate fun Route.initRouting() {\n+ get(\"/{repositoryId}/\") {\n+ val repositoryId = RepositoryId(call.parameters[\"repositoryId\"]!!)\n+ val versionHash = client.asyncStore?.get(repositoryId.getBranchKey())!!\n+ // TODO 404 if it doesn't exist\n+ val version = CLVersion.loadFromHash(versionHash, getStore())\n+ respondVersion(version)\n+ }\nget(\"/{repositoryId}/{versionHash}/\") {\nval versionHash = call.parameters[\"versionHash\"]!!\n// TODO 404 if it doesn't exist\n@@ -88,11 +93,11 @@ class JsonModelServer(val client: IModelClient) {\nupdateNode(nodeData, containmentData = null, t)\n}\n}\n+ respondVersion(repo.endEdit()!!)\n} finally {\nrepo.dispose()\n}\n- respondVersion(baseVersion)\n}\npost(\"/generate-ids\") {\nval quantity = call.request.queryParameters[\"quantity\"]?.toInt() ?: 1000\n@@ -211,17 +216,24 @@ class JsonModelServer(val client: IModelClient) {\nif (node is PNodeAdapter) {\njson.put(\"nodeId\", node.nodeId)\n}\n+ val jsonProperties = JSONObject()\n+ val jsonReferences = JSONObject()\n+ val jsonChildren = JSONObject()\n+ json.put(\"properties\", jsonProperties)\n+ json.put(\"references\", jsonReferences)\n+ json.put(\"children\", jsonChildren)\n+\nfor (role in node.getPropertyRoles()) {\n- json.put(role, node.getPropertyValue(role))\n+ jsonProperties.put(role, node.getPropertyValue(role))\n}\nfor (role in node.getReferenceRoles()) {\nval target = node.getReferenceTarget(role)\nif (target is PNodeAdapter) {\n- json.put(role, target.nodeId)\n+ jsonReferences.put(role, target.nodeId)\n}\n}\nfor (children in node.allChildren.groupBy { it.roleInParent }) {\n- json.put(children.key ?: \"null\", children.value.map { node2json(it) })\n+ jsonChildren.put(children.key ?: \"null\", children.value.map { node2json(it) })\n}\nreturn json\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "model-server/src/test/kotlin/JsonAPITest.kt",
"new_path": "model-server/src/test/kotlin/JsonAPITest.kt",
"diff": "import io.ktor.client.request.*\nimport io.ktor.client.statement.*\nimport io.ktor.http.*\n-import io.ktor.server.application.*\nimport io.ktor.server.testing.*\n-import kotlinx.serialization.json.buildJsonObject\nimport org.json.JSONArray\nimport org.json.JSONObject\nimport org.modelix.model.api.ITree\n@@ -54,6 +52,18 @@ class JsonAPITest {\nassertEmptyVersion(JSONObject(response.bodyAsText()))\n}\n+ private suspend fun ApplicationTestBuilder.getCurrentVersion(): JSONObject {\n+ val response = client.get(\"/json/$repoId/\")\n+ val bodyAsText = response.bodyAsText()\n+ println(bodyAsText)\n+ assertEquals(HttpStatusCode.OK, response.status)\n+ return JSONObject(bodyAsText)\n+ }\n+\n+ private suspend fun ApplicationTestBuilder.getCurrentVersionHash(): String {\n+ return getCurrentVersion().getString(\"versionHash\")\n+ }\n+\n@Test\nfun generateIds() = runTest {\nval quantity = 100\n@@ -76,14 +86,52 @@ class JsonAPITest {\n@Test\nfun createNodes() = runTest {\n+ createFirstNode()\n+ }\n+\n+ @Test\n+ fun concurrentChange() = runTest {\n+ val nodeId = createFirstNode()\n+ val v1 = getCurrentVersionHash()\n+ val queryAndAssert: suspend (String, String?)->Unit = { role, expectedValue ->\n+ val merged = getCurrentVersion()\n+ val entity = getFirstEntity(merged)\n+ assertEquals(expectedValue, entity.getJSONObject(\"properties\").getString(role))\n+ }\n+ changeNode(v1, nodeId, \"name\", \"EntityB\")\n+ changeNode(v1, nodeId, \"color\", \"black\")\n+ queryAndAssert(\"name\", \"EntityB\")\n+ queryAndAssert(\"color\", \"black\")\n+\n+ changeNode(v1, nodeId, \"name\", \"EntityC\")\n+ queryAndAssert(\"name\", \"EntityC\")\n+ queryAndAssert(\"color\", \"black\")\n+ }\n+\n+ private suspend fun ApplicationTestBuilder.changeNode(versionHash: String, id: Long, role: String, value: String) {\n+ val response = client.post(\"/json/$repoId/$versionHash/update\") {\n+ contentType(ContentType.Application.Json)\n+ setBody(buildJSONArray(\n+ buildJSONObject {\n+ put(\"nodeId\", id)\n+ put(\"properties\", buildJSONObject {\n+ put(role, value)\n+ })\n+ }\n+ ).toString(2))\n+ }\n+ }\n+\n+ private suspend fun ApplicationTestBuilder.createFirstNode(): Long {\nval versionHash = JSONObject(client.post(\"/json/$repoId/init\").bodyAsText()).getString(\"versionHash\")\n- val ids = JSONArray(client.post(\"/json/generate-ids?quantity=10&format=list\").bodyAsText())\n+ val ids = JSONArray(client.post(\"/json/generate-ids?quantity=1&format=list\").bodyAsText())\n.asLongList().toMutableList()\n+ val id = ids.removeFirst()\nval response = client.post(\"/json/$repoId/$versionHash/update\") {\ncontentType(ContentType.Application.Json)\nsetBody(buildJSONArray(\nbuildJSONObject {\n- put(\"nodeId\", ids.removeFirst())\n+ put(\"nodeId\", id)\nput(\"parentId\", ITree.ROOT_ID)\nput(\"role\", \"entities\")\nput(\"properties\", buildJSONObject {\n@@ -92,10 +140,18 @@ class JsonAPITest {\n}\n).toString(2))\n}\n- val bodyAsText = response.bodyAsText()\n- println(bodyAsText)\n+ val responseBody = response.bodyAsText()\n+ println(responseBody)\nassertEquals(HttpStatusCode.OK, response.status)\n- assertEmptyVersion(JSONObject(bodyAsText))\n+ val version = JSONObject(responseBody)\n+ val entityJson =\n+ getFirstEntity(version)\n+ assertEquals(id, entityJson.getLong(\"nodeId\"))\n+ assertEquals(\"EntityA\", entityJson.getJSONObject(\"properties\").getString(\"name\"))\n+ return id\n}\n+ private fun getFirstEntity(version: JSONObject) =\n+ version.getJSONObject(\"root\").getJSONObject(\"children\").getJSONArray(\"entities\").getJSONObject(0)\n+\n}\n\\ No newline at end of file\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | concurrent change |
426,496 | 14.06.2022 17:34:37 | -7,200 | 5c530c0aa622e289ff11fa89ac8c598808ea80db | the provided base version wasn't used, but the latest one instead | [
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/kotlin/org/modelix/model/server/JsonModelServer.kt",
"new_path": "model-server/src/main/kotlin/org/modelix/model/server/JsonModelServer.kt",
"diff": "@@ -22,12 +22,14 @@ import io.ktor.server.routing.*\nimport org.json.JSONArray\nimport org.json.JSONObject\nimport org.modelix.authorization.AuthenticatedUser\n+import org.modelix.model.VersionMerger\nimport org.modelix.model.api.*\nimport org.modelix.model.client.IModelClient\nimport org.modelix.model.client.ReplicatedRepository\nimport org.modelix.model.lazy.CLTree\nimport org.modelix.model.lazy.CLVersion\nimport org.modelix.model.lazy.RepositoryId\n+import org.modelix.model.operations.OTBranch\nimport org.modelix.model.persistent.CPVersion\nimport java.util.Date\n@@ -43,6 +45,11 @@ class JsonModelServer(val client: IModelClient) {\n}\n}\n+ private fun getCurrentVersion(repositoryId: RepositoryId): CLVersion {\n+ val versionHash = client.asyncStore?.get(repositoryId.getBranchKey())!!\n+ return CLVersion.loadFromHash(versionHash, getStore())\n+ }\n+\nprivate fun Route.initRouting() {\nget(\"/{repositoryId}/\") {\nval repositoryId = RepositoryId(call.parameters[\"repositoryId\"]!!)\n@@ -83,20 +90,28 @@ class JsonModelServer(val client: IModelClient) {\n}\nval baseVersion = CLVersion(baseVersionData, getStore())\nval repositoryId = RepositoryId(call.parameters[\"repositoryId\"]!!)\n+ val branch = OTBranch(PBranch(baseVersion.tree, client.idGenerator), client.idGenerator, client.storeCache!!)\nval userId = (call.principal<AuthenticatedUser>() ?: AuthenticatedUser.ANONYMOUS_USER).userIds.firstOrNull()\n- // TODO cache ReplicatedRepository instances\n- val repo = ReplicatedRepository(client, repositoryId, RepositoryId.DEFAULT_BRANCH, { userId ?: \"<no user>\" })\n- try {\n- val branch = repo.branch\nbranch.computeWriteT { t ->\nfor (nodeData in (0 until updateData.length()).map { updateData.getJSONObject(it) }) {\nupdateNode(nodeData, containmentData = null, t)\n}\n}\n- respondVersion(repo.endEdit()!!)\n- } finally {\n- repo.dispose()\n- }\n+\n+ val operationsAndTree = branch.operationsAndTree\n+ val newVersion = CLVersion.createRegularVersion(\n+ client.idGenerator.generate(),\n+ Date().toString(),\n+ userId,\n+ operationsAndTree.second as CLTree,\n+ baseVersion,\n+ operationsAndTree.first.map { it.getOriginalOp() }.toTypedArray()\n+ )\n+ repositoryId.getBranchKey()\n+ val mergedVersion = VersionMerger(client.storeCache!!, client.idGenerator)\n+ .mergeChange(getCurrentVersion(repositoryId), newVersion)\n+ client.asyncStore!!.put(repositoryId.getBranchKey(), mergedVersion.hash)\n+ respondVersion(mergedVersion)\n}\npost(\"/generate-ids\") {\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | the provided base version wasn't used, but the latest one instead |
426,496 | 15.06.2022 09:13:17 | -7,200 | e4e2a132ec9b2c4126fce393e23dfc9975e51d1c | IdGenerator.generate(quantity: Int) | [
{
"change_type": "MODIFY",
"old_path": "model-client/src/commonMain/kotlin/org/modelix/model/client/IdGenerator.kt",
"new_path": "model-client/src/commonMain/kotlin/org/modelix/model/client/IdGenerator.kt",
"diff": "@@ -19,4 +19,5 @@ import org.modelix.model.api.IIdGenerator\nexpect class IdGenerator(clientId: Int) : IIdGenerator {\noverride fun generate(): Long\n+ fun generate(quantity: Int): LongRange\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "model-client/src/jvmMain/kotlin/org/modelix/model/client/IdGenerator.kt",
"new_path": "model-client/src/jvmMain/kotlin/org/modelix/model/client/IdGenerator.kt",
"diff": "@@ -22,10 +22,15 @@ actual class IdGenerator actual constructor(clientId: Int) : IIdGenerator {\nprivate val clientId: Long = clientId.toLong()\nprivate val idSequence: AtomicLong = AtomicLong(this.clientId shl 32)\nactual override fun generate(): Long {\n- val id = idSequence.incrementAndGet()\n- if (id ushr 32 != clientId) {\n+ return generate(1).first\n+ }\n+ actual fun generate(quantity: Int): LongRange {\n+ require(quantity >= 1)\n+ val lastId = idSequence.addAndGet(quantity.toLong())\n+ if (lastId ushr 32 != clientId) {\nthrow RuntimeException(\"End of ID range\")\n}\n- return id\n+ val firstId = lastId - quantity + 1\n+ return LongRange(firstId, lastId)\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/kotlin/org/modelix/model/server/JsonModelServer.kt",
"new_path": "model-server/src/main/kotlin/org/modelix/model/server/JsonModelServer.kt",
"diff": "@@ -25,10 +25,12 @@ import org.modelix.authorization.AuthenticatedUser\nimport org.modelix.model.VersionMerger\nimport org.modelix.model.api.*\nimport org.modelix.model.client.IModelClient\n+import org.modelix.model.client.IdGenerator\nimport org.modelix.model.client.ReplicatedRepository\nimport org.modelix.model.lazy.CLTree\nimport org.modelix.model.lazy.CLVersion\nimport org.modelix.model.lazy.RepositoryId\n+import org.modelix.model.metameta.PersistedConcept\nimport org.modelix.model.operations.OTBranch\nimport org.modelix.model.persistent.CPVersion\nimport java.util.Date\n@@ -116,40 +118,11 @@ class JsonModelServer(val client: IModelClient) {\n}\npost(\"/generate-ids\") {\nval quantity = call.request.queryParameters[\"quantity\"]?.toInt() ?: 1000\n- when (val format = call.request.queryParameters[\"format\"]) {\n- \"list\" -> {\n- respondJson((1..quantity).map { client.idGenerator.generate() }.toJsonArray())\n- }\n- \"ranges\", null -> {\n- val ranges = ArrayList<Array<Long>>()\n- val firstId = client.idGenerator.generate()\n- var currentRange = arrayOf(firstId, firstId)\n- ranges += currentRange\n- var count = 1\n- while (count < quantity) {\n- // TODO add a method IIdGenerator.generate(quantity: Int): LongRange\n- val id = client.idGenerator.generate()\n- if (id == currentRange[1] + 1) {\n- currentRange[1] = id\n- } else {\n- currentRange = arrayOf(id, id)\n- ranges += currentRange\n- }\n- count++\n- }\n-\n- val json = ranges.map { range ->\n- JSONObject().apply {\n- put(\"first\", range[0])\n- put(\"last\", range[1])\n- }\n- }.toJsonArray()\n- respondJson(json)\n- }\n- else -> {\n- call.respond(HttpStatusCode.BadRequest, \"Invalid format '$format'\")\n- }\n- }\n+ val ids = (client.idGenerator as IdGenerator).generate(quantity)\n+ respondJson(buildJSONObject {\n+ put(\"first\", ids.first)\n+ put(\"last\", ids.last)\n+ })\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "model-server/src/test/kotlin/JsonAPITest.kt",
"new_path": "model-server/src/test/kotlin/JsonAPITest.kt",
"diff": "@@ -73,19 +73,9 @@ class JsonAPITest {\nval quantity = 100\nval response = client.post(\"/json/generate-ids?quantity=$quantity\")\nassertEquals(HttpStatusCode.OK, response.status)\n- val jsonRanges = JSONArray(response.bodyAsText())\n- val ranges = jsonRanges.map { it as JSONObject }\n- .map { LongRange(it.getLong(\"first\"), it.getLong(\"last\")) }\n- assertEquals(quantity, ranges.sumOf { it.count() })\n- }\n-\n- @Test\n- fun generateIdsAsList() = runTest {\n- val quantity = 100\n- val response = client.post(\"/json/generate-ids?quantity=$quantity&format=list\")\n- assertEquals(HttpStatusCode.OK, response.status)\n- val ids = JSONArray(response.bodyAsText())\n- assertEquals(quantity, ids.length())\n+ val jsonRange = JSONObject(response.bodyAsText())\n+ val range = jsonRange.let { LongRange(it.getLong(\"first\"), it.getLong(\"last\")) }\n+ assertEquals(quantity, range.count())\n}\n@Test\n@@ -154,9 +144,7 @@ class JsonAPITest {\n}\nprivate suspend fun ApplicationTestBuilder.createNode(baseVersionHash: String, parentId: Long, role: String?, index: Int?, content: JSONObject.()->Unit): Pair<Long, JSONObject> {\n- val ids = JSONArray(client.post(\"/json/generate-ids?quantity=1&format=list\").bodyAsText())\n- .asLongList().toMutableList()\n- val id = ids.removeFirst()\n+ val id = JSONObject(client.post(\"/json/generate-ids?quantity=1\").bodyAsText()).getLong(\"first\")\nval response = client.post(\"/json/$repoId/$baseVersionHash/update\") {\ncontentType(ContentType.Application.Json)\nval jsonString = buildJSONArray(\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | IdGenerator.generate(quantity: Int) |
426,496 | 15.06.2022 10:21:00 | -7,200 | 63e152e49164aeef531cb1450e436d0e8763d5ee | /json/ lists the available endpoints | [
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/kotlin/org/modelix/model/server/JsonModelServer.kt",
"new_path": "model-server/src/main/kotlin/org/modelix/model/server/JsonModelServer.kt",
"diff": "@@ -16,9 +16,11 @@ package org.modelix.model.server\nimport io.ktor.http.*\nimport io.ktor.server.application.*\nimport io.ktor.server.auth.*\n+import io.ktor.server.html.*\nimport io.ktor.server.request.*\nimport io.ktor.server.response.*\nimport io.ktor.server.routing.*\n+import kotlinx.html.*\nimport org.json.JSONArray\nimport org.json.JSONObject\nimport org.modelix.authorization.AuthenticatedUser\n@@ -53,6 +55,33 @@ class JsonModelServer(val client: IModelClient) {\n}\nprivate fun Route.initRouting() {\n+ get(\"/\") {\n+ call.respondHtml(HttpStatusCode.OK) {\n+ body {\n+ table {\n+ tr {\n+ td { +\"GET /{repositoryId}/\" }\n+ td { + \"Returns the model content of the latest version on the master branch.\" }\n+ }\n+ tr {\n+ td { +\"GET /{repositoryId}/{versionHash}/\" }\n+ td { + \"Returns the model content of the specified version on the master branch.\" }\n+ }\n+ tr {\n+ td { +\"POST /{repositoryId}/init\" }\n+ td { + \"Initializes a new repository.\" }\n+ }\n+ tr {\n+ td { +\"POST /{repositoryId}/{versionHash}/update\" }\n+ td {\n+ + \"Applies the delta to the specified version of the model and merges\"\n+ +\" it into the master branch. Return the model content after the merge.\"\n+ }\n+ }\n+ }\n+ }\n+ }\n+ }\nget(\"/{repositoryId}/\") {\nval repositoryId = RepositoryId(call.parameters[\"repositoryId\"]!!)\nval versionHash = client.asyncStore?.get(repositoryId.getBranchKey())!!\n"
},
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/kotlin/org/modelix/model/server/LocalModelClient.kt",
"new_path": "model-server/src/main/kotlin/org/modelix/model/server/LocalModelClient.kt",
"diff": "@@ -24,15 +24,10 @@ import org.modelix.model.lazy.IDeserializingKeyValueStore\nimport org.modelix.model.lazy.ObjectStoreCache\nclass LocalModelClient(private val store: IStoreClient) : IModelClient {\n- override val clientId: Int\n- override val idGenerator: IIdGenerator\n+ override val clientId: Int by lazy { store.generateId(\"clientId\").toInt() }\n+ override val idGenerator: IIdGenerator by lazy { IdGenerator(clientId) }\nprivate val objectCache: IDeserializingKeyValueStore = ObjectStoreCache(this)\n- init {\n- clientId = store.generateId(\"clientId\").toInt()\n- idGenerator = IdGenerator(clientId)\n- }\n-\noverride fun get(key: String): String? {\nreturn store[key]\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/kotlin/org/modelix/model/server/Main.kt",
"new_path": "model-server/src/main/kotlin/org/modelix/model/server/Main.kt",
"diff": "@@ -242,12 +242,25 @@ object Main {\nModelixAuthorization.init(localModelClient)\nval historyHandler = HistoryHandler(localModelClient)\n+ val jsonModelServer = JsonModelServer(localModelClient)\nval ktorServer: NettyApplicationEngine = embeddedServer(Netty, port = port) {\nmodelServer.init(this)\nhistoryHandler.init(this)\n+ jsonModelServer.init(this)\nrouting {\nget(\"/\") {\ncall.respondHtml {\n+ head {\n+ style { +\"\"\"\n+ table {\n+ border-collapse: collapse;\n+ }\n+ td, th {\n+ border: 1px solid #888;\n+ padding: 3px 12px;\n+ }\n+ \"\"\".trimIndent() }\n+ }\nbody {\ndiv { +\"Model Server\" }\nbr {}\n@@ -258,6 +271,9 @@ object Main {\nli {\na(\"history/\") { +\"Model History\" }\n}\n+ li {\n+ a(\"json/\") { +\"JSON API for JavaScript clients\" }\n+ }\n}\n}\n}\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | /json/ lists the available endpoints |
426,496 | 15.06.2022 15:45:02 | -7,200 | 4622926744350eef65b4ab421a09f322ca2a7e1b | angular app listens for model changes | [
{
"change_type": "MODIFY",
"old_path": "model-server/build.gradle.kts",
"new_path": "model-server/build.gradle.kts",
"diff": "@@ -25,6 +25,7 @@ val kotlinVersion: String by project\ndependencies {\nimplementation(\"org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion\")\nimplementation(\"org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2\")\n+ implementation(\"org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.1\")\nimplementation(\"org.modelix:model-api:$mpsExtensionsVersion\")\nimplementation(project(\":model-client\", configuration = \"jvmRuntimeElements\"))\n"
},
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/kotlin/org/modelix/model/server/IStoreClient.kt",
"new_path": "model-server/src/main/kotlin/org/modelix/model/server/IStoreClient.kt",
"diff": "*/\npackage org.modelix.model.server\n+import kotlinx.coroutines.CoroutineScope\n+import kotlinx.coroutines.delay\n+import kotlinx.coroutines.launch\nimport org.modelix.model.IKeyListener\ninterface IStoreClient {\n@@ -26,3 +29,43 @@ interface IStoreClient {\nfun removeListener(key: String, listener: IKeyListener)\nfun generateId(key: String): Long\n}\n+\n+suspend fun CoroutineScope.pollEntry(storeClient: IStoreClient, key: String, lastKnownValue: String?, handler: suspend (String?)->Unit) {\n+ var handlerCalled = false\n+ val callHandler: suspend (String?)->Unit = {\n+ handlerCalled = true\n+ handler(it)\n+ }\n+ val listener = object : IKeyListener {\n+ override fun changed(key_: String, newValue: String?) {\n+ launch {\n+ callHandler(newValue)\n+ }\n+ }\n+ }\n+ try {\n+ storeClient.listen(key, listener)\n+ if (lastKnownValue != null) {\n+ // This could be done before registering the listener, but\n+ // then we have to check it twice,\n+ // because the value could change between the first read and\n+ // registering the listener.\n+ // Most of the time the value will be equal to the last\n+ // known value.\n+ // Registering the listener without needing it is less\n+ // likely to happen.\n+ val value = storeClient[key]\n+ if (value != lastKnownValue) {\n+ callHandler(value)\n+ return\n+ }\n+ }\n+ for (i in 1..250) {\n+ if (handlerCalled) break\n+ delay(100L)\n+ }\n+ } finally {\n+ storeClient.removeListener(key, listener)\n+ }\n+ if (!handlerCalled) handler(storeClient[key])\n+}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/kotlin/org/modelix/model/server/JsonModelServer.kt",
"new_path": "model-server/src/main/kotlin/org/modelix/model/server/JsonModelServer.kt",
"diff": "@@ -24,6 +24,7 @@ import kotlinx.html.*\nimport org.json.JSONArray\nimport org.json.JSONObject\nimport org.modelix.authorization.AuthenticatedUser\n+import org.modelix.model.IKeyListener\nimport org.modelix.model.VersionMerger\nimport org.modelix.model.api.*\nimport org.modelix.model.client.IModelClient\n@@ -37,7 +38,7 @@ import org.modelix.model.operations.OTBranch\nimport org.modelix.model.persistent.CPVersion\nimport java.util.Date\n-class JsonModelServer(val client: IModelClient) {\n+class JsonModelServer(val client: LocalModelClient) {\nfun getStore() = client.storeCache!!\n@@ -95,6 +96,14 @@ class JsonModelServer(val client: IModelClient) {\nval version = CLVersion.loadFromHash(versionHash, getStore())\nrespondVersion(version)\n}\n+ get(\"/{repositoryId}/{versionHash}/poll\") {\n+ val repositoryId = RepositoryId(call.parameters[\"repositoryId\"]!!)\n+ val versionHash = call.parameters[\"versionHash\"]!!\n+ pollEntry(client.store, repositoryId.getBranchKey(), versionHash) { newValue ->\n+ val version = CLVersion.loadFromHash(newValue!!, getStore())\n+ respondVersion(version)\n+ }\n+ }\npost(\"/{repositoryId}/init\") {\n// TODO error if it already exists\nval repositoryId = RepositoryId(call.parameters[\"repositoryId\"]!!)\n"
},
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/kotlin/org/modelix/model/server/KtorModelServer.kt",
"new_path": "model-server/src/main/kotlin/org/modelix/model/server/KtorModelServer.kt",
"diff": "@@ -24,6 +24,7 @@ import io.ktor.server.request.*\nimport io.ktor.server.response.*\nimport io.ktor.server.routing.*\nimport io.ktor.util.pipeline.*\n+import kotlinx.coroutines.CoroutineScope\nimport kotlinx.coroutines.delay\nimport kotlinx.coroutines.launch\nimport org.json.JSONArray\n@@ -142,39 +143,10 @@ class KtorModelServer(val storeClient: IStoreClient) {\nval key: String = call.parameters[\"key\"]!!\nval lastKnownValue = call.request.queryParameters[\"lastKnownValue\"]\ncheckKeyPermission(key, EPermissionType.READ)\n- val listener = object : IKeyListener {\n- override fun changed(key_: String, newValue: String?) {\n- launch {\n- if (!call.response.isCommitted) respondValue(key, newValue)\n+ pollEntry(storeClient, key, lastKnownValue) { newValue ->\n+ respondValue(key, newValue)\n}\n}\n- }\n- try {\n- storeClient.listen(key, listener)\n- if (lastKnownValue != null) {\n- // This could be done before registering the listener, but\n- // then we have to check it twice,\n- // because the value could change between the first read and\n- // registering the listener.\n- // Most of the time the value will be equal to the last\n- // known value.\n- // Registering the listener without needing it is less\n- // likely to happen.\n- val value = storeClient[key]\n- if (value != lastKnownValue) {\n- if (!call.response.isCommitted) respondValue(key, value)\n- return@get\n- }\n- }\n- for (i in 1..250) {\n- if (call.response.isCommitted) break\n- delay(100L)\n- }\n- } finally {\n- storeClient.removeListener(key, listener)\n- }\n- if (!call.response.isCommitted) respondValue(key, storeClient[key])\n- }\nget(\"/generateToken\") {\nvar email = call.request.header(\"X-Forwarded-Email\")\n"
},
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/kotlin/org/modelix/model/server/LocalModelClient.kt",
"new_path": "model-server/src/main/kotlin/org/modelix/model/server/LocalModelClient.kt",
"diff": "@@ -23,7 +23,7 @@ import org.modelix.model.client.IdGenerator\nimport org.modelix.model.lazy.IDeserializingKeyValueStore\nimport org.modelix.model.lazy.ObjectStoreCache\n-class LocalModelClient(private val store: IStoreClient) : IModelClient {\n+class LocalModelClient(val store: IStoreClient) : IModelClient {\noverride val clientId: Int by lazy { store.generateId(\"clientId\").toInt() }\noverride val idGenerator: IIdGenerator by lazy { IdGenerator(clientId) }\nprivate val objectCache: IDeserializingKeyValueStore = ObjectStoreCache(this)\n"
},
{
"change_type": "MODIFY",
"old_path": "samples/angular/modelix-angular-sandbox/src/app/model.service.ts",
"new_path": "samples/angular/modelix-angular-sandbox/src/app/model.service.ts",
"diff": "@@ -18,10 +18,21 @@ export class ModelService {\nthis.readFromServer()\n}\n- public readFromServer() {\n- this.http.get<VersionData>(\"http://localhost:30761/model/json/angular-sandbox/\").subscribe(data => {\n+ private pollServer() {\n+ this.http.get<VersionData>(`http://localhost:30761/model/json/angular-sandbox/${this.versionHash}/poll`).subscribe(data => {\n+ this.versionReceived(data)\n+ })\n+ }\n+\n+ private versionReceived(data: VersionData) {\nthis.versionHash = data.versionHash\nthis.loadNode(data.root)\n+ this.pollServer()\n+ }\n+\n+ private readFromServer() {\n+ this.http.get<VersionData>(\"http://localhost:30761/model/json/angular-sandbox/\").subscribe(data => {\n+ this.versionReceived(data)\n})\n}\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | angular app listens for model changes |
426,496 | 15.06.2022 15:48:15 | -7,200 | 8413c24eeb5e9fdceeb583387c1087255e165ae7 | implemented IdGenerator.generator(quantity) in JS | [
{
"change_type": "MODIFY",
"old_path": "model-client/src/jsMain/kotlin/org/modelix/model/client/IdGenerator.kt",
"new_path": "model-client/src/jsMain/kotlin/org/modelix/model/client/IdGenerator.kt",
"diff": "@@ -21,14 +21,21 @@ actual class IdGenerator actual constructor(clientId: Int) : IIdGenerator {\nprivate var idSequence: Long\nprivate val clientId: Long = clientId.toLong()\nactual override fun generate(): Long {\n- val id = ++idSequence\n- if (id ushr 32 != clientId) {\n+ return generate(1).first\n+ }\n+ actual fun generate(quantity: Int): LongRange {\n+ require(quantity >= 1)\n+ idSequence += quantity.toLong()\n+ val lastId = idSequence\n+ if (lastId ushr 32 != clientId) {\nthrow RuntimeException(\"End of ID range\")\n}\n- return id\n+ val firstId = lastId - quantity + 1\n+ return LongRange(firstId, lastId)\n}\ninit {\nidSequence = this.clientId shl 32\n}\n+\n}\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | implemented IdGenerator.generator(quantity) in JS |
426,496 | 15.06.2022 16:44:47 | -7,200 | f200ff2fcc8f09f589415c3a2c534e2c62c55072 | Send only delta instead of full version | [
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/kotlin/org/modelix/model/server/JsonModelServer.kt",
"new_path": "model-server/src/main/kotlin/org/modelix/model/server/JsonModelServer.kt",
"diff": "@@ -101,7 +101,8 @@ class JsonModelServer(val client: LocalModelClient) {\nval versionHash = call.parameters[\"versionHash\"]!!\npollEntry(client.store, repositoryId.getBranchKey(), versionHash) { newValue ->\nval version = CLVersion.loadFromHash(newValue!!, getStore())\n- respondVersion(version)\n+ val oldVersion = CLVersion.loadFromHash(versionHash, getStore())\n+ respondVersion(version, oldVersion)\n}\n}\npost(\"/{repositoryId}/init\") {\n@@ -151,7 +152,7 @@ class JsonModelServer(val client: LocalModelClient) {\nval mergedVersion = VersionMerger(client.storeCache!!, client.idGenerator)\n.mergeChange(getCurrentVersion(repositoryId), newVersion)\nclient.asyncStore!!.put(repositoryId.getBranchKey(), mergedVersion.hash)\n- respondVersion(mergedVersion)\n+ respondVersion(mergedVersion, baseVersion)\n}\npost(\"/generate-ids\") {\n@@ -221,12 +222,41 @@ class JsonModelServer(val client: LocalModelClient) {\nreturn nodeId\n}\n- private suspend fun CallContext.respondVersion(version: CLVersion) {\n- val rootNode = PNodeAdapter(ITree.ROOT_ID, TreePointer(version.tree))\n+ private suspend fun CallContext.respondVersion(version: CLVersion, oldVersion: CLVersion? = null) {\n+ val branch = TreePointer(version.tree)\n+ val rootNode = PNodeAdapter(ITree.ROOT_ID, branch)\nval json = JSONObject()\njson.put(\"repositoryId\", version.tree.getId())\njson.put(\"versionHash\", version.hash)\n- json.put(\"root\", node2json(rootNode))\n+ if (oldVersion == null) {\n+ json.put(\"root\", node2json(rootNode, true))\n+ } else {\n+ val nodesToInclude = HashSet<Long>()\n+ version.tree.visitChanges(oldVersion.tree, object : ITreeChangeVisitorEx {\n+ override fun childrenChanged(nodeId: Long, role: String?) {\n+ nodesToInclude += nodeId\n+ }\n+\n+ override fun containmentChanged(nodeId: Long) {}\n+\n+ override fun propertyChanged(nodeId: Long, role: String) {\n+ nodesToInclude += nodeId\n+ }\n+\n+ override fun referenceChanged(nodeId: Long, role: String) {\n+ nodesToInclude += nodeId\n+ }\n+\n+ override fun nodeAdded(nodeId: Long) {\n+ nodesToInclude += nodeId\n+ }\n+\n+ override fun nodeRemoved(nodeId: Long) {}\n+ })\n+ val changedNodes = nodesToInclude.map { node2json(PNodeAdapter(it, branch), false) }.toJsonArray()\n+ json.put(\"nodes\", changedNodes)\n+ version.tree\n+ }\nrespondJson(json)\n}\n@@ -237,7 +267,7 @@ class JsonModelServer(val client: LocalModelClient) {\ncall.respondText(json.toString(2), ContentType.Application.Json)\n}\n- private fun node2json(node: INode): JSONObject {\n+ private fun node2json(node: INode, includeDescendants: Boolean): JSONObject {\nval json = JSONObject()\nif (node is PNodeAdapter) {\njson.put(\"nodeId\", node.nodeId.toString())\n@@ -259,7 +289,11 @@ class JsonModelServer(val client: LocalModelClient) {\n}\n}\nfor (children in node.allChildren.groupBy { it.roleInParent }) {\n- jsonChildren.put(children.key ?: \"null\", children.value.map { node2json(it) })\n+ if (includeDescendants) {\n+ jsonChildren.put(children.key ?: \"null\", children.value.map { node2json(it, includeDescendants) })\n+ } else {\n+ jsonChildren.put(children.key ?: \"null\", children.value.map { (it as PNodeAdapter).nodeId.toString() })\n+ }\n}\nreturn json\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "samples/angular/modelix-angular-sandbox/src/app/model.service.ts",
"new_path": "samples/angular/modelix-angular-sandbox/src/app/model.service.ts",
"diff": "@@ -21,18 +21,24 @@ export class ModelService {\nprivate pollServer() {\nthis.http.get<VersionData>(`http://localhost:30761/model/json/angular-sandbox/${this.versionHash}/poll`).subscribe(data => {\nthis.versionReceived(data)\n+ this.pollServer()\n})\n}\nprivate versionReceived(data: VersionData) {\nthis.versionHash = data.versionHash\n- this.loadNode(data.root)\n- this.pollServer()\n+ if (data.root !== undefined) this.loadNode(data.root)\n+ if (data.nodes !== undefined) {\n+ for (let node of data.nodes) {\n+ this.loadNode(node)\n+ }\n+ }\n}\nprivate readFromServer() {\nthis.http.get<VersionData>(\"http://localhost:30761/model/json/angular-sandbox/\").subscribe(data => {\nthis.versionReceived(data)\n+ this.pollServer()\n})\n}\n@@ -60,7 +66,7 @@ export class ModelService {\n}]\nthis.http.post<VersionData>(`http://localhost:30761/model/json/angular-sandbox/${this.versionHash}/update`, body).subscribe(data => {\n- this.loadNode(data.root)\n+ this.versionReceived(data)\n})\n}\n@@ -94,7 +100,7 @@ export class ModelService {\n}]\nthis.http.post<VersionData>(`http://localhost:30761/model/json/angular-sandbox/${this.versionHash}/update`, body).subscribe(data => {\n- this.loadNode(data.root)\n+ this.versionReceived(data)\n})\n}\n}\n@@ -102,7 +108,8 @@ export class ModelService {\ninterface VersionData {\nrepositoryId: string,\nversionHash: string,\n- root: NodeData\n+ root: NodeData | undefined,\n+ nodes: NodeData[] | undefined,\n}\ninterface NodeData {\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Send only delta instead of full version |
426,496 | 16.06.2022 12:44:04 | -7,200 | ebff8696b2b3571d5bd104b93ed561e45434c841 | WebSocket enpoint for sending/receiving model deltas | [
{
"change_type": "MODIFY",
"old_path": "model-server/build.gradle.kts",
"new_path": "model-server/build.gradle.kts",
"diff": "@@ -45,6 +45,7 @@ dependencies {\nimplementation(\"io.ktor:ktor-server-auth:$ktorVersion\")\nimplementation(\"io.ktor:ktor-server-status-pages:$ktorVersion\")\nimplementation(\"io.ktor:ktor-server-forwarded-header:$ktorVersion\")\n+ implementation(\"io.ktor:ktor-server-websockets:$ktorVersion\")\nimplementation(project(\":authorization\"))\nimplementation(project(\":authorization-ui\"))\n"
},
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/kotlin/org/modelix/model/server/JsonModelServer.kt",
"new_path": "model-server/src/main/kotlin/org/modelix/model/server/JsonModelServer.kt",
"diff": "package org.modelix.model.server\nimport io.ktor.http.*\n+import io.ktor.network.sockets.*\nimport io.ktor.server.application.*\nimport io.ktor.server.auth.*\nimport io.ktor.server.html.*\nimport io.ktor.server.request.*\nimport io.ktor.server.response.*\nimport io.ktor.server.routing.*\n-import kotlinx.html.*\n+import io.ktor.server.websocket.*\n+import io.ktor.websocket.*\n+import kotlinx.coroutines.launch\n+import kotlinx.coroutines.sync.Mutex\n+import kotlinx.coroutines.sync.withLock\n+import kotlinx.html.body\n+import kotlinx.html.table\n+import kotlinx.html.td\n+import kotlinx.html.tr\nimport org.json.JSONArray\nimport org.json.JSONObject\nimport org.modelix.authorization.AuthenticatedUser\nimport org.modelix.model.IKeyListener\nimport org.modelix.model.VersionMerger\nimport org.modelix.model.api.*\n-import org.modelix.model.client.IModelClient\nimport org.modelix.model.client.IdGenerator\n-import org.modelix.model.client.ReplicatedRepository\nimport org.modelix.model.lazy.CLTree\nimport org.modelix.model.lazy.CLVersion\nimport org.modelix.model.lazy.RepositoryId\n-import org.modelix.model.metameta.PersistedConcept\nimport org.modelix.model.operations.OTBranch\nimport org.modelix.model.persistent.CPVersion\n-import java.util.Date\n+import java.util.*\nclass JsonModelServer(val client: LocalModelClient) {\nfun getStore() = client.storeCache!!\nfun init(application: Application) {\n- application.routing {\n+ application.apply {\n+ install(WebSockets)\n+ routing {\nroute(\"/json\") {\ninitRouting()\n}\n}\n}\n+ }\nprivate fun getCurrentVersion(repositoryId: RepositoryId): CLVersion {\nval versionHash = client.asyncStore?.get(repositoryId.getBranchKey())!!\n@@ -68,6 +77,10 @@ class JsonModelServer(val client: LocalModelClient) {\ntd { +\"GET /{repositoryId}/{versionHash}/\" }\ntd { + \"Returns the model content of the specified version on the master branch.\" }\n}\n+ tr {\n+ td { +\"GET /{repositoryId}/{versionHash}/poll\" }\n+ td { + \"\" }\n+ }\ntr {\ntd { +\"POST /{repositoryId}/init\" }\ntd { + \"Initializes a new repository.\" }\n@@ -105,6 +118,46 @@ class JsonModelServer(val client: LocalModelClient) {\nrespondVersion(version, oldVersion)\n}\n}\n+ webSocket(\"/{repositoryId}/ws\") {\n+ val repositoryId = RepositoryId(call.parameters[\"repositoryId\"]!!)\n+ val userId = (call.principal<AuthenticatedUser>() ?: AuthenticatedUser.ANONYMOUS_USER).userIds.firstOrNull()\n+\n+ var lastVersion: CLVersion? = null\n+ val deltaMutex = Mutex()\n+ val sendDelta: suspend (CLVersion)->Unit = { newVersion ->\n+ deltaMutex.withLock {\n+ send(versionAsJson(newVersion, lastVersion).toString())\n+ lastVersion = newVersion\n+ }\n+ }\n+\n+ val listener = object : IKeyListener {\n+ override fun changed(key: String, value: String?) {\n+ if (value == null) return\n+ launch {\n+ val newVersion = CLVersion.loadFromHash(value, client.storeCache)\n+ sendDelta(newVersion)\n+ }\n+ }\n+ }\n+\n+ client.listen(repositoryId.getBranchKey(), listener)\n+ try {\n+ sendDelta(getCurrentVersion(repositoryId))\n+ for (frame in incoming) {\n+ when (frame) {\n+ is Frame.Text -> {\n+ val updateData = JSONArray(frame.readText())\n+ val mergedVersion = applyUpdate(lastVersion!!, updateData, repositoryId, userId)\n+ sendDelta(mergedVersion)\n+ }\n+ else -> {}\n+ }\n+ }\n+ } finally {\n+ client.removeListener(repositoryId.getBranchKey(), listener)\n+ }\n+ }\npost(\"/{repositoryId}/init\") {\n// TODO error if it already exists\nval repositoryId = RepositoryId(call.parameters[\"repositoryId\"]!!)\n@@ -123,6 +176,8 @@ class JsonModelServer(val client: LocalModelClient) {\n}\npost(\"/{repositoryId}/{versionHash}/update\") {\nval updateData = JSONArray(call.receiveText())\n+ val repositoryId = RepositoryId(call.parameters[\"repositoryId\"]!!)\n+ val userId = (call.principal<AuthenticatedUser>() ?: AuthenticatedUser.ANONYMOUS_USER).userIds.firstOrNull()\nval baseVersionHash = call.parameters[\"versionHash\"]!!\nval baseVersionData = getStore().get(baseVersionHash, { CPVersion.deserialize(it) })\nif (baseVersionData == null) {\n@@ -130,9 +185,27 @@ class JsonModelServer(val client: LocalModelClient) {\nreturn@post\n}\nval baseVersion = CLVersion(baseVersionData, getStore())\n- val repositoryId = RepositoryId(call.parameters[\"repositoryId\"]!!)\n+ val mergedVersion = applyUpdate(baseVersion, updateData, repositoryId, userId)\n+ respondVersion(mergedVersion, baseVersion)\n+\n+ }\n+ post(\"/generate-ids\") {\n+ val quantity = call.request.queryParameters[\"quantity\"]?.toInt() ?: 1000\n+ val ids = (client.idGenerator as IdGenerator).generate(quantity)\n+ respondJson(buildJSONObject {\n+ put(\"first\", ids.first)\n+ put(\"last\", ids.last)\n+ })\n+ }\n+ }\n+\n+ private fun applyUpdate(\n+ baseVersion: CLVersion,\n+ updateData: JSONArray,\n+ repositoryId: RepositoryId,\n+ userId: String?\n+ ): CLVersion {\nval branch = OTBranch(PBranch(baseVersion.tree, client.idGenerator), client.idGenerator, client.storeCache!!)\n- val userId = (call.principal<AuthenticatedUser>() ?: AuthenticatedUser.ANONYMOUS_USER).userIds.firstOrNull()\nbranch.computeWriteT { t ->\nfor (nodeData in (0 until updateData.length()).map { updateData.getJSONObject(it) }) {\nupdateNode(nodeData, containmentData = null, t)\n@@ -152,17 +225,8 @@ class JsonModelServer(val client: LocalModelClient) {\nval mergedVersion = VersionMerger(client.storeCache!!, client.idGenerator)\n.mergeChange(getCurrentVersion(repositoryId), newVersion)\nclient.asyncStore!!.put(repositoryId.getBranchKey(), mergedVersion.hash)\n- respondVersion(mergedVersion, baseVersion)\n-\n- }\n- post(\"/generate-ids\") {\n- val quantity = call.request.queryParameters[\"quantity\"]?.toInt() ?: 1000\n- val ids = (client.idGenerator as IdGenerator).generate(quantity)\n- respondJson(buildJSONObject {\n- put(\"first\", ids.first)\n- put(\"last\", ids.last)\n- })\n- }\n+ // TODO handle concurrent write to the branchKey, otherwise versions might get lost. See ReplicatedRepository.\n+ return mergedVersion\n}\nprivate fun updateNode(nodeData: JSONObject, containmentData: ContainmentData?, t: IWriteTransaction): Long {\n@@ -223,6 +287,14 @@ class JsonModelServer(val client: LocalModelClient) {\n}\nprivate suspend fun CallContext.respondVersion(version: CLVersion, oldVersion: CLVersion? = null) {\n+ val json = versionAsJson(version, oldVersion)\n+ respondJson(json)\n+ }\n+\n+ private fun versionAsJson(\n+ version: CLVersion,\n+ oldVersion: CLVersion?\n+ ): JSONObject {\nval branch = TreePointer(version.tree)\nval rootNode = PNodeAdapter(ITree.ROOT_ID, branch)\nval json = JSONObject()\n@@ -257,7 +329,7 @@ class JsonModelServer(val client: LocalModelClient) {\njson.put(\"nodes\", changedNodes)\nversion.tree\n}\n- respondJson(json)\n+ return json\n}\nprivate suspend fun CallContext.respondJson(json: JSONObject) {\n"
},
{
"change_type": "MODIFY",
"old_path": "proxy/nginx.conf",
"new_path": "proxy/nginx.conf",
"diff": "@@ -12,8 +12,9 @@ http {\nlocation ~ ^/model/(.*)$ {\nproxy_pass http://model.default.svc.cluster.local:28101/$1$is_args$args;\n- proxy_set_header Connection '';\nproxy_http_version 1.1;\n+ proxy_set_header Upgrade $http_upgrade;\n+ proxy_set_header Connection \"upgrade\";\nchunked_transfer_encoding off;\nproxy_buffering off;\nproxy_cache off;\n"
},
{
"change_type": "MODIFY",
"old_path": "samples/angular/modelix-angular-sandbox/src/app/comp/customer/customer.component.html",
"new_path": "samples/angular/modelix-angular-sandbox/src/app/comp/customer/customer.component.html",
"diff": "<div style=\"border: 1px solid black; background-color: #aaa; padding: 10px; display: inline-block\">\n<div *ngIf=\"this.exists()\">\n- <div>Name: <input #nameInput type=\"text\" [value]=\"readName()\" (change)=\"writeName(nameInput.value)\" /></div>\n+ <div>Name: <input #nameInput\n+ (change)=\"writeName(nameInput.value)\"\n+ (keydown)=\"writeName(nameInput.value)\"\n+ (keyup)=\"writeName(nameInput.value)\"\n+ (keypress)=\"writeName(nameInput.value)\"\n+ [value]=\"readName()\"\n+ type=\"text\"/></div>\n<div>Name: {{ readName() }}</div>\n</div>\n<button *ngIf=\"!this.exists()\" (click)=\"this.create()\">Create Customer</button>\n"
},
{
"change_type": "MODIFY",
"old_path": "samples/angular/modelix-angular-sandbox/src/app/model.service.ts",
"new_path": "samples/angular/modelix-angular-sandbox/src/app/model.service.ts",
"diff": "@@ -15,7 +15,22 @@ export class ModelService {\nthis.http.post<IdRangeData>(\"http://localhost:30761/model/json/generate-ids?quantity=10000\", undefined).subscribe(data => {\nthis.idGenerator = new IdGenerator(BigInt(data.first), BigInt(data.last))\n})\n- this.readFromServer()\n+ //this.readFromServer()\n+ this.connectWS(\"ws://localhost:30761/model/json/angular-sandbox/ws\")\n+ }\n+\n+ private connectWS(url: string) {\n+ let ws = new WebSocket(url);\n+ ws.onmessage = (e) => {\n+ let updateData = JSON.parse(e.data)\n+ this.versionReceived(updateData)\n+ }\n+ ws.onerror = (e) => {\n+ console.log('WebSocket error: ', e);\n+ }\n+ ws.onclose = (e) => {\n+ setTimeout(() => { this.connectWS(url) }, 1000)\n+ }\n}\nprivate pollServer() {\n@@ -143,6 +158,7 @@ class IdGenerator {\npublic generate(): NodeId {\nlet id = this.next++;\nif (id > this.last) throw Error(\"Out of IDs\")\n+ // TODO get new IDs from the server\nreturn id.toString()\n}\n}\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | WebSocket enpoint for sending/receiving model deltas |
426,496 | 20.06.2022 09:49:53 | -7,200 | 213f591f79f186f349d6d1047457edcea69d2003 | Make keycloak work behind the reverse proxy | [
{
"change_type": "MODIFY",
"old_path": "proxy/nginx.conf",
"new_path": "proxy/nginx.conf",
"diff": "@@ -42,6 +42,21 @@ http {\nproxy_pass http://keycloak.default.svc.cluster.local:8080/$1$is_args$args;\n}\n+ # keycloak doesn't work behind a subpath. That is probably a bug in keycloak and this is the workaround.\n+ location ~ ^/((resources|admin|js|realms)/.*)$ {\n+ proxy_set_header Referer $http_referer;\n+ proxy_set_header X-Real-IP $remote_addr;\n+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n+ proxy_set_header X-Forwarded-Proto $scheme;\n+ proxy_set_header Host $http_host;\n+ proxy_set_header X-Forwarded-Host $http_host;\n+\n+ proxy_http_version 1.1;\n+ proxy_set_header Upgrade $http_upgrade;\n+ proxy_set_header Connection \"upgrade\";\n+ proxy_pass http://keycloak.default.svc.cluster.local:8080/$1$is_args$args;\n+ }\n+\nlocation ~ ^/github/(.*/ws/.*)$ {\nproxy_http_version 1.1;\nproxy_set_header Upgrade $http_upgrade;\n@@ -74,6 +89,14 @@ http {\n# }\nlocation ~ ^/workspace-manager/(.*)$ {\n+ proxy_set_header Referer $http_referer;\n+ proxy_set_header X-Real-IP $remote_addr;\n+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n+ proxy_set_header X-Forwarded-Proto $scheme;\n+ proxy_set_header X-Forwarded-Url $scheme://$http_host/model/$1;\n+ proxy_set_header Host $http_host;\n+ proxy_set_header X-Forwarded-Host $http_host;\n+\nproxy_http_version 1.1;\nproxy_set_header Upgrade $http_upgrade;\nproxy_set_header Connection \"upgrade\";\n@@ -81,6 +104,14 @@ http {\n}\nlocation ~ ^/instances-manager/(.*)$ {\n+ proxy_set_header Referer $http_referer;\n+ proxy_set_header X-Real-IP $remote_addr;\n+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n+ proxy_set_header X-Forwarded-Proto $scheme;\n+ proxy_set_header X-Forwarded-Url $scheme://$http_host/model/$1;\n+ proxy_set_header Host $http_host;\n+ proxy_set_header X-Forwarded-Host $http_host;\n+\nproxy_http_version 1.1;\nproxy_set_header Upgrade $http_upgrade;\nproxy_set_header Connection \"upgrade\";\n@@ -88,6 +119,14 @@ http {\n}\nlocation ~ ^/([a-zA-Z0-9-_*]+/.*)$ {\n+ proxy_set_header Referer $http_referer;\n+ proxy_set_header X-Real-IP $remote_addr;\n+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n+ proxy_set_header X-Forwarded-Proto $scheme;\n+ proxy_set_header X-Forwarded-Url $scheme://$http_host/model/$1;\n+ proxy_set_header Host $http_host;\n+ proxy_set_header X-Forwarded-Host $http_host;\n+\nproxy_http_version 1.1;\nproxy_set_header Upgrade $http_upgrade;\nproxy_set_header Connection \"upgrade\";\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Make keycloak work behind the reverse proxy |
426,496 | 20.06.2022 11:03:30 | -7,200 | 1cf85708a3511f183eefb5cc235b647ac5cf32e9 | Persist keycloak settings in the postgres database | [
{
"change_type": "MODIFY",
"old_path": "doc/running-modelix.md",
"new_path": "doc/running-modelix.md",
"diff": "@@ -99,3 +99,19 @@ To connect your local MPS IDE follow these instructions:\n- `./docker-build.sh`\n- `./docker-push.sh`\n- `kubectl apply -f deployment.yaml -f service.yaml`\n+\n+## Configure Authorization\n+\n+- `./kubernetes-open-keycloak.sh`\n+- Navigate to **Administration Console**\n+- Hover over **Master** in the top left corner and choose **Add realm**\n+- Name: *modelix*\n+- Create\n+- **Clients** > Create\n+- Client ID: *modelix*\n+- Save\n+- Valid Redirect URIs: *\n+- Save\n+- Roles > Add Role\n+- Role Name: modelix-admin\n+- Save\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "kubernetes-open-keycloak.sh",
"diff": "+#!/bin/sh\n+\n+SERVICEPORT=$(kubectl get service/proxy | sed -n \"s/.*80:\\([0-9]*\\)\\/TCP.*/\\1/p\")\n+open \"http://localhost:${SERVICEPORT}/keycloak/\"\n"
},
{
"change_type": "MODIFY",
"old_path": "kubernetes/common/keycloak.yaml",
"new_path": "kubernetes/common/keycloak.yaml",
"diff": "@@ -42,6 +42,14 @@ spec:\nvalue: \"edge\"\n- name: PROXY_ADDRESS_FORWARDING\nvalue: \"true\"\n+ - name: KC_DB\n+ value: \"postgres\"\n+ - name: KC_DB_USERNAME\n+ value: \"modelix\"\n+ - name: KC_DB_PASSWORD\n+ value: \"modelix\"\n+ - name: KC_DB_URL\n+ value: \"jdbc:postgresql://db:5432/\"\nports:\n- name: http\ncontainerPort: 8080\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Persist keycloak settings in the postgres database |
426,496 | 21.06.2022 10:26:00 | -7,200 | 560af27a75704ca9a31a8a768336805e6f27e1f3 | Store JWT token in cookie | [
{
"change_type": "MODIFY",
"old_path": "authorization/src/main/kotlin/org/modelix/authorization/ktor/KtorAuthUtils.kt",
"new_path": "authorization/src/main/kotlin/org/modelix/authorization/ktor/KtorAuthUtils.kt",
"diff": "@@ -20,15 +20,21 @@ import io.ktor.client.engine.cio.*\nimport io.ktor.http.*\nimport io.ktor.server.application.*\nimport io.ktor.server.auth.*\n+import io.ktor.server.auth.jwt.*\nimport io.ktor.server.plugins.*\nimport io.ktor.server.plugins.forwardedheaders.*\nimport io.ktor.server.plugins.statuspages.*\nimport io.ktor.server.request.*\nimport io.ktor.server.response.*\nimport io.ktor.server.routing.*\n+import io.ktor.server.sessions.*\nimport io.ktor.util.pipeline.*\nimport org.json.JSONObject\nimport org.modelix.authorization.*\n+import org.modelix.model.persistent.SerializationUtil\n+import java.net.URLEncoder\n+import java.nio.charset.StandardCharsets\n+import javax.swing.text.html.HTMLDocument.RunElement\nclass OAuthProxyAuth(authenticationConfig: Config) : AuthenticationProvider(authenticationConfig) {\noverride suspend fun onAuthenticate(context: AuthenticationContext) {\n@@ -48,17 +54,25 @@ public fun AuthenticationConfig.oauthProxy(\nregister(provider)\n}\n-val keycloakOAuth = \"keycloakOAuth\"\n+const val keycloakOAuth = \"keycloakOAuth\"\n+const val sessionAuth = \"sessionAuth\"\n+val jwtAuth = \"jwtAuth\"\n+private const val callbackEndpointName = \"oauth-callback\"\n+private const val originalUrlParameterName = \"originalUrl\"\nfun Application.installAuthentication() {\ninstall(XForwardedHeaders)\ninstall(Authentication) {\n+ session<UserSession>(sessionAuth) {\n+ this.validate {\n+ it.getUser()\n+ }\n+ }\noauth(keycloakOAuth) {\nclient = HttpClient(CIO)\nproviderLookup = {\n- val keycloakAddress = \"http://localhost:30761/keycloak\"\nOAuthServerSettings.OAuth2ServerSettings(\nname = \"keycloak\",\n- authorizeUrl = \"http://localhost:31310/realms/modelix/protocol/openid-connect/auth\",\n+ authorizeUrl = \"http://${request.host()}:${request.port()}/realms/modelix/protocol/openid-connect/auth\",\naccessTokenUrl = \"http://keycloak:8080/realms/modelix/protocol/openid-connect/token\",\nclientId = \"modelix\",\nclientSecret = \"VkD4oEhsGQyUCCEyO1ZHgTUV1BLp3gLl\",\n@@ -68,8 +82,16 @@ fun Application.installAuthentication() {\n)\n}\nurlProvider = {\n- (request.headers[\"X-Forwarded-Url\"] ?:\n+ val forwardedUrl = request.headers[\"X-Forwarded-Url\"]\n+ var originalUrl = (forwardedUrl ?:\n\"\"\"${request.origin.scheme}://${request.host()}:${request.port()}${request.uri}\"\"\").substringBefore(\"?\")\n+ val pathPrefix = if (forwardedUrl == null) \"\" else {\n+ val forwardedPath = \"/\" + forwardedUrl.substringBefore(\"?\").substringAfter(\"://\").substringAfter(\"/\")\n+ if (!forwardedPath.endsWith(request.path())) \"\" else forwardedPath.substringBefore(this.request.path())\n+ }\n+\n+ originalUrl = URLEncoder.encode(originalUrl, StandardCharsets.UTF_8)\n+ \"\"\"${request.origin.scheme}://${request.host()}:${request.port()}$pathPrefix/$callbackEndpointName?$originalUrlParameterName=$originalUrl\"\"\"\n}\n}\n}\n@@ -91,14 +113,53 @@ fun Application.installAuthentication() {\n}\n}\n}\n+ install(Sessions) {\n+ cookie<UserSession>(\"modelix_user_session\") {\n+ cookie.path = \"/\"\n+ cookie.maxAgeInSeconds = 14*24*60*60\n+ cookie.httpOnly = false\n+ }\n+ }\n+ routing {\n+ authenticate(sessionAuth, keycloakOAuth) {\n+ get(\"/$callbackEndpointName\") {\n+ val originalUrl = call.parameters[\"originalUrl\"] ?: \"/\"\n+ val token = call.getJWTAsString()\n+ if (token == null) {\n+ call.respondText(\"Token missing\", status = HttpStatusCode.InternalServerError)\n+ return@get\n+ }\n+ call.sessions.set(UserSession(token))\n+ call.respondRedirect(originalUrl)\n+ }\n+ get(\"/user\") {\n+ var jwtString = call.getJWTAsString()\n+ if (jwtString == null) {\n+ call.respondText(\"No token available\")\n+ } else {\n+ val claims = JWT.decode(jwtString).claims.map { \"${it.key}: ${it.value}\" }.joinToString(\"\\n\")\n+ call.respondText(\"\"\"\n+ |Token: ${jwtString}\n+ |\n+ |$claims\"\"\".trimMargin())\n+ }\n+ }\n+ }\n+ }\n+\n+}\n+\n+data class UserSession(val token: String) {\n+ fun getJWT(): DecodedJWT = JWT.decode(token)\n+ fun getUser(): AuthenticatedUser = getJWT().toUser()\n}\nfun Route.requiresPermission(permission: PermissionId, type: EPermissionType, body: Route.()->Unit) {\n- authenticate(keycloakOAuth) {\n+ authenticate(sessionAuth, keycloakOAuth) {\nintercept(ApplicationCallPipeline.Call) {\nModelixAuthorization.checkPermission(\ncall.getUser(),\n- ModelixAuthorization.AUTHORIZATION_DATA_PERMISSION,\n+ permission,\ntype\n)\n}\n@@ -111,7 +172,11 @@ fun PipelineContext<Unit, ApplicationCall>.getUser(): AuthenticatedUser {\n}\nfun ApplicationCall.getUser(): AuthenticatedUser {\n- val jwt = getJWT() ?: return AuthenticatedUser.ANONYMOUS_USER\n+ return getJWT().toUser()\n+}\n+\n+fun DecodedJWT?.toUser(): AuthenticatedUser {\n+ val jwt = this ?: return AuthenticatedUser.ANONYMOUS_USER\nval name = jwt.getClaim(\"preferred_username\")?.asString() ?: AuthenticatedUser.ANONYMOUS_USER_ID\nval roles = jwt.getClaim(\"realm_access\")?.asString()?.let {\nval roles = JSONObject(it).getJSONArray(\"roles\")\n@@ -121,8 +186,16 @@ fun ApplicationCall.getUser(): AuthenticatedUser {\n}\nfun ApplicationCall.getJWT(): DecodedJWT? {\n+ return getJWTAsString()?.let { JWT.decode(it) }\n+}\n+\n+\n+fun ApplicationCall.getJWTAsString(): String? {\nval tokenResponse = principal<OAuthAccessTokenResponse.OAuth2>()\n- return tokenResponse?.let { JWT.decode(it.accessToken) }\n+ if (tokenResponse != null) return tokenResponse.accessToken\n+ val session = sessions.get<UserSession>()\n+ // TODO verify signature of the token\n+ return session?.token\n}\nfun RequestConnectionPoint.fullUri(): String {\n"
},
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/kotlin/org/modelix/model/server/JsonModelServer.kt",
"new_path": "model-server/src/main/kotlin/org/modelix/model/server/JsonModelServer.kt",
"diff": "@@ -36,6 +36,7 @@ import org.modelix.authorization.AuthenticatedUser\nimport org.modelix.authorization.EPermissionType\nimport org.modelix.authorization.PermissionId\nimport org.modelix.authorization.ktor.getJWT\n+import org.modelix.authorization.ktor.getJWTAsString\nimport org.modelix.authorization.ktor.getUser\nimport org.modelix.authorization.ktor.requiresPermission\nimport org.modelix.model.IKeyListener\n@@ -61,14 +62,6 @@ class JsonModelServer(val client: LocalModelClient) {\nroute(\"/json\") {\ninitRouting()\n}\n- get(\"/user\") {\n- val jwt = call.getJWT()\n- if (jwt == null) {\n- call.respondText(\"No token available\")\n- } else {\n- call.respondText(jwt.claims.map { \"${it.key}: ${it.value}\" }.joinToString(\"\\n\"))\n- }\n- }\n}\n}\n}\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Store JWT token in cookie |
426,496 | 21.06.2022 10:38:12 | -7,200 | 73588765ab94c8ccf143645704b52591f01d29cf | Store JWT token in cookie (2) | [
{
"change_type": "MODIFY",
"old_path": "authorization/build.gradle.kts",
"new_path": "authorization/build.gradle.kts",
"diff": "@@ -13,6 +13,7 @@ dependencies {\nimplementation(\"io.ktor:ktor-server-status-pages:$ktorVersion\")\nimplementation(\"io.ktor:ktor-server-auth:$ktorVersion\")\nimplementation(\"io.ktor:ktor-server-auth-jwt:$ktorVersion\")\n+ implementation(\"io.ktor:ktor-server-sessions:$ktorVersion\")\nimplementation(\"io.ktor:ktor-server-forwarded-header:$ktorVersion\")\nimplementation(\"io.ktor\", \"ktor-client-cio\", ktorVersion)\nimplementation(project(\":model-client\", configuration = \"jvmRuntimeElements\"))\n"
},
{
"change_type": "MODIFY",
"old_path": "authorization/src/main/kotlin/org/modelix/authorization/ktor/KtorAuthUtils.kt",
"new_path": "authorization/src/main/kotlin/org/modelix/authorization/ktor/KtorAuthUtils.kt",
"diff": "@@ -114,10 +114,14 @@ fun Application.installAuthentication() {\n}\n}\ninstall(Sessions) {\n- cookie<UserSession>(\"modelix_user_session\") {\n+ cookie<UserSession>(\"modelix-jwt\") {\ncookie.path = \"/\"\ncookie.maxAgeInSeconds = 14*24*60*60\ncookie.httpOnly = false\n+ serializer = object : SessionSerializer<UserSession> {\n+ override fun deserialize(text: String) = UserSession(text)\n+ override fun serialize(session: UserSession) = session.token\n+ }\n}\n}\nrouting {\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Store JWT token in cookie (2) |
426,496 | 21.06.2022 11:53:55 | -7,200 | cf84923679157619cd613757b7c4f7a5ae32e030 | Verify JWT signature | [
{
"change_type": "MODIFY",
"old_path": "authorization/src/main/kotlin/org/modelix/authorization/ktor/KtorAuthUtils.kt",
"new_path": "authorization/src/main/kotlin/org/modelix/authorization/ktor/KtorAuthUtils.kt",
"diff": "*/\npackage org.modelix.authorization.ktor\n+import com.auth0.jwk.JwkProviderBuilder\nimport com.auth0.jwt.JWT\n+import com.auth0.jwt.algorithms.Algorithm\nimport com.auth0.jwt.interfaces.DecodedJWT\nimport io.ktor.client.*\nimport io.ktor.client.engine.cio.*\nimport io.ktor.http.*\nimport io.ktor.server.application.*\nimport io.ktor.server.auth.*\n-import io.ktor.server.auth.jwt.*\nimport io.ktor.server.plugins.*\nimport io.ktor.server.plugins.forwardedheaders.*\nimport io.ktor.server.plugins.statuspages.*\n@@ -31,10 +32,10 @@ import io.ktor.server.sessions.*\nimport io.ktor.util.pipeline.*\nimport org.json.JSONObject\nimport org.modelix.authorization.*\n-import org.modelix.model.persistent.SerializationUtil\n+import java.net.URL\nimport java.net.URLEncoder\nimport java.nio.charset.StandardCharsets\n-import javax.swing.text.html.HTMLDocument.RunElement\n+import java.security.interfaces.RSAPublicKey\nclass OAuthProxyAuth(authenticationConfig: Config) : AuthenticationProvider(authenticationConfig) {\noverride suspend fun onAuthenticate(context: AuthenticationContext) {\n@@ -59,12 +60,16 @@ const val sessionAuth = \"sessionAuth\"\nval jwtAuth = \"jwtAuth\"\nprivate const val callbackEndpointName = \"oauth-callback\"\nprivate const val originalUrlParameterName = \"originalUrl\"\n+private const val KEYCLOAK_INTERNAL_HOST = \"keycloak:8080\"\n+private const val KEYCLOAK_REALM = \"modelix\"\n+private const val KEYCLOAK_CLIENT = \"modelix\"\n+\nfun Application.installAuthentication() {\ninstall(XForwardedHeaders)\ninstall(Authentication) {\nsession<UserSession>(sessionAuth) {\nthis.validate {\n- it.getUser()\n+ it.getJWT().nullIfInvalid().toUser()\n}\n}\noauth(keycloakOAuth) {\n@@ -72,9 +77,9 @@ fun Application.installAuthentication() {\nproviderLookup = {\nOAuthServerSettings.OAuth2ServerSettings(\nname = \"keycloak\",\n- authorizeUrl = \"http://${request.host()}:${request.port()}/realms/modelix/protocol/openid-connect/auth\",\n- accessTokenUrl = \"http://keycloak:8080/realms/modelix/protocol/openid-connect/token\",\n- clientId = \"modelix\",\n+ authorizeUrl = \"http://${request.host()}:${request.port()}/realms/$KEYCLOAK_REALM/protocol/openid-connect/auth\",\n+ accessTokenUrl = \"http://$KEYCLOAK_INTERNAL_HOST/realms/$KEYCLOAK_REALM/protocol/openid-connect/token\",\n+ clientId = KEYCLOAK_CLIENT,\nclientSecret = \"VkD4oEhsGQyUCCEyO1ZHgTUV1BLp3gLl\",\naccessTokenRequiresBasicAuth = false,\nrequestMethod = HttpMethod.Post, // must POST to token endpoint\n@@ -176,7 +181,7 @@ fun PipelineContext<Unit, ApplicationCall>.getUser(): AuthenticatedUser {\n}\nfun ApplicationCall.getUser(): AuthenticatedUser {\n- return getJWT().toUser()\n+ return getValidJWT().toUser()\n}\nfun DecodedJWT?.toUser(): AuthenticatedUser {\n@@ -189,17 +194,44 @@ fun DecodedJWT?.toUser(): AuthenticatedUser {\nreturn AuthenticatedUser(setOf(name), roles + AuthenticatedUser.PUBLIC_GROUP)\n}\n-fun ApplicationCall.getJWT(): DecodedJWT? {\n- return getJWTAsString()?.let { JWT.decode(it) }\n+fun ApplicationCall.getValidJWT(): DecodedJWT? {\n+ return getJWTAsString()?.let { JWT.decode(it) }?.nullIfInvalid()\n}\nfun ApplicationCall.getJWTAsString(): String? {\nval tokenResponse = principal<OAuthAccessTokenResponse.OAuth2>()\n- if (tokenResponse != null) return tokenResponse.accessToken\n+ val tokenString = if (tokenResponse != null) {\n+ tokenResponse.accessToken\n+ } else {\nval session = sessions.get<UserSession>()\n- // TODO verify signature of the token\n- return session?.token\n+ session?.token\n+ }\n+\n+ return tokenString\n+}\n+\n+private val jwkProvider = JwkProviderBuilder(URL(\"http://$KEYCLOAK_INTERNAL_HOST/realms/$KEYCLOAK_REALM/protocol/openid-connect/certs\")).build()\n+fun verifyTokenSignature(token: DecodedJWT) {\n+ val jwk = jwkProvider.get(token.keyId)\n+ val publicKey = jwk.publicKey as? RSAPublicKey ?: throw RuntimeException(\"Invalid key type\")\n+ val algorithm = when (jwk.algorithm) {\n+ \"RS256\" -> Algorithm.RSA256(publicKey, null)\n+ \"RSA384\" -> Algorithm.RSA384(publicKey, null)\n+ \"RS512\" -> Algorithm.RSA512(publicKey, null)\n+ else -> throw Exception(\"Unsupported Algorithm\")\n+ }\n+ val verifier = JWT.require(algorithm).build()\n+ verifier.verify(token)\n+}\n+\n+fun DecodedJWT.nullIfInvalid(): DecodedJWT? {\n+ return try {\n+ verifyTokenSignature(this)\n+ this\n+ } catch (e: Exception) {\n+ null\n+ }\n}\nfun RequestConnectionPoint.fullUri(): String {\n"
},
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/kotlin/org/modelix/model/server/JsonModelServer.kt",
"new_path": "model-server/src/main/kotlin/org/modelix/model/server/JsonModelServer.kt",
"diff": "package org.modelix.model.server\nimport io.ktor.http.*\n-import io.ktor.network.sockets.*\nimport io.ktor.server.application.*\n-import io.ktor.server.auth.*\nimport io.ktor.server.html.*\nimport io.ktor.server.request.*\nimport io.ktor.server.response.*\n@@ -32,11 +30,8 @@ import kotlinx.html.td\nimport kotlinx.html.tr\nimport org.json.JSONArray\nimport org.json.JSONObject\n-import org.modelix.authorization.AuthenticatedUser\nimport org.modelix.authorization.EPermissionType\nimport org.modelix.authorization.PermissionId\n-import org.modelix.authorization.ktor.getJWT\n-import org.modelix.authorization.ktor.getJWTAsString\nimport org.modelix.authorization.ktor.getUser\nimport org.modelix.authorization.ktor.requiresPermission\nimport org.modelix.model.IKeyListener\n"
},
{
"change_type": "MODIFY",
"old_path": "proxy/nginx.conf",
"new_path": "proxy/nginx.conf",
"diff": "@@ -93,7 +93,7 @@ http {\nproxy_set_header X-Real-IP $remote_addr;\nproxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\nproxy_set_header X-Forwarded-Proto $scheme;\n- proxy_set_header X-Forwarded-Url $scheme://$http_host/model/$1;\n+ proxy_set_header X-Forwarded-Url $scheme://$http_host/workspace-manager/$1;\nproxy_set_header Host $http_host;\nproxy_set_header X-Forwarded-Host $http_host;\n@@ -108,7 +108,7 @@ http {\nproxy_set_header X-Real-IP $remote_addr;\nproxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\nproxy_set_header X-Forwarded-Proto $scheme;\n- proxy_set_header X-Forwarded-Url $scheme://$http_host/model/$1;\n+ proxy_set_header X-Forwarded-Url $scheme://$http_host/instances-manager/$1;\nproxy_set_header Host $http_host;\nproxy_set_header X-Forwarded-Host $http_host;\n@@ -123,7 +123,7 @@ http {\nproxy_set_header X-Real-IP $remote_addr;\nproxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\nproxy_set_header X-Forwarded-Proto $scheme;\n- proxy_set_header X-Forwarded-Url $scheme://$http_host/model/$1;\n+ proxy_set_header X-Forwarded-Url $scheme://$http_host/$1;\nproxy_set_header Host $http_host;\nproxy_set_header X-Forwarded-Host $http_host;\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Verify JWT signature |
426,496 | 21.06.2022 14:42:21 | -7,200 | ec1f70ab21b38c8f43090f753b35ba2bef0e8f06 | Verify JWT expiration date | [
{
"change_type": "MODIFY",
"old_path": "authorization/src/main/kotlin/org/modelix/authorization/ktor/KtorAuthUtils.kt",
"new_path": "authorization/src/main/kotlin/org/modelix/authorization/ktor/KtorAuthUtils.kt",
"diff": "@@ -17,11 +17,14 @@ import com.auth0.jwk.JwkProviderBuilder\nimport com.auth0.jwt.JWT\nimport com.auth0.jwt.algorithms.Algorithm\nimport com.auth0.jwt.interfaces.DecodedJWT\n+import com.auth0.jwt.interfaces.Payload\nimport io.ktor.client.*\nimport io.ktor.client.engine.cio.*\nimport io.ktor.http.*\n+import io.ktor.http.auth.*\nimport io.ktor.server.application.*\nimport io.ktor.server.auth.*\n+import io.ktor.server.auth.jwt.*\nimport io.ktor.server.plugins.*\nimport io.ktor.server.plugins.forwardedheaders.*\nimport io.ktor.server.plugins.statuspages.*\n@@ -37,6 +40,16 @@ import java.net.URLEncoder\nimport java.nio.charset.StandardCharsets\nimport java.security.interfaces.RSAPublicKey\n+private const val keycloakOAuth = \"keycloakOAuth\"\n+private const val sessionAuth = \"sessionAuth\"\n+private const val jwtAuth = \"jwtAuth\"\n+private const val callbackEndpointName = \"oauth-callback\"\n+private const val originalUrlParameterName = \"originalUrl\"\n+private const val KEYCLOAK_INTERNAL_HOST = \"keycloak:8080\"\n+private const val KEYCLOAK_REALM = \"modelix\"\n+private const val KEYCLOAK_CLIENT = \"modelix\"\n+private val jwkProvider = JwkProviderBuilder(URL(\"http://$KEYCLOAK_INTERNAL_HOST/realms/$KEYCLOAK_REALM/protocol/openid-connect/certs\")).build()\n+\nclass OAuthProxyAuth(authenticationConfig: Config) : AuthenticationProvider(authenticationConfig) {\noverride suspend fun onAuthenticate(context: AuthenticationContext) {\nval pricipal = AuthenticatedUser.fromHttpHeaders(context.call.request.headers.entries())\n@@ -55,21 +68,21 @@ public fun AuthenticationConfig.oauthProxy(\nregister(provider)\n}\n-const val keycloakOAuth = \"keycloakOAuth\"\n-const val sessionAuth = \"sessionAuth\"\n-val jwtAuth = \"jwtAuth\"\n-private const val callbackEndpointName = \"oauth-callback\"\n-private const val originalUrlParameterName = \"originalUrl\"\n-private const val KEYCLOAK_INTERNAL_HOST = \"keycloak:8080\"\n-private const val KEYCLOAK_REALM = \"modelix\"\n-private const val KEYCLOAK_CLIENT = \"modelix\"\n-\nfun Application.installAuthentication() {\ninstall(XForwardedHeaders)\ninstall(Authentication) {\n+ jwt(jwtAuth) {\n+ verifier(jwkProvider) {\n+ acceptLeeway(60L)\n+ }\n+ challenge { _, _ -> } // login and token generation is done by OAuth\n+ this.validate {\n+ it.payload.toUser()\n+ }\n+ }\nsession<UserSession>(sessionAuth) {\nthis.validate {\n- it.getJWT().nullIfInvalid().toUser()\n+ it.getJWT().nullIfInvalid()?.toUser()\n}\n}\noauth(keycloakOAuth) {\n@@ -130,7 +143,7 @@ fun Application.installAuthentication() {\n}\n}\nrouting {\n- authenticate(sessionAuth, keycloakOAuth) {\n+ authenticate(jwtAuth, sessionAuth, keycloakOAuth) {\nget(\"/$callbackEndpointName\") {\nval originalUrl = call.parameters[\"originalUrl\"] ?: \"/\"\nval token = call.getJWTAsString()\n@@ -138,6 +151,10 @@ fun Application.installAuthentication() {\ncall.respondText(\"Token missing\", status = HttpStatusCode.InternalServerError)\nreturn@get\n}\n+ if (JWT.decode(token).nullIfInvalid() == null) {\n+ call.respondText(\"Token invalid: $token\", status = HttpStatusCode.InternalServerError)\n+ return@get\n+ }\ncall.sessions.set(UserSession(token))\ncall.respondRedirect(originalUrl)\n}\n@@ -160,11 +177,11 @@ fun Application.installAuthentication() {\ndata class UserSession(val token: String) {\nfun getJWT(): DecodedJWT = JWT.decode(token)\n- fun getUser(): AuthenticatedUser = getJWT().toUser()\n+ fun getUser(): AuthenticatedUser? = getJWT().nullIfInvalid()?.toUser()\n}\nfun Route.requiresPermission(permission: PermissionId, type: EPermissionType, body: Route.()->Unit) {\n- authenticate(sessionAuth, keycloakOAuth) {\n+ authenticate(jwtAuth, sessionAuth, keycloakOAuth) {\nintercept(ApplicationCallPipeline.Call) {\nModelixAuthorization.checkPermission(\ncall.getUser(),\n@@ -181,11 +198,11 @@ fun PipelineContext<Unit, ApplicationCall>.getUser(): AuthenticatedUser {\n}\nfun ApplicationCall.getUser(): AuthenticatedUser {\n- return getValidJWT().toUser()\n+ return principal<AuthenticatedUser>() ?: getValidJWT().toUser() ?: AuthenticatedUser.ANONYMOUS_USER\n}\n-fun DecodedJWT?.toUser(): AuthenticatedUser {\n- val jwt = this ?: return AuthenticatedUser.ANONYMOUS_USER\n+fun Payload?.toUser(): AuthenticatedUser? {\n+ val jwt = this ?: return null\nval name = jwt.getClaim(\"preferred_username\")?.asString() ?: AuthenticatedUser.ANONYMOUS_USER_ID\nval roles = jwt.getClaim(\"realm_access\")?.asString()?.let {\nval roles = JSONObject(it).getJSONArray(\"roles\")\n@@ -211,7 +228,16 @@ fun ApplicationCall.getJWTAsString(): String? {\nreturn tokenString\n}\n-private val jwkProvider = JwkProviderBuilder(URL(\"http://$KEYCLOAK_INTERNAL_HOST/realms/$KEYCLOAK_REALM/protocol/openid-connect/certs\")).build()\n+fun ApplicationCall.jwtFromAuthHeader(): DecodedJWT? {\n+ val authHeader = request.parseAuthorizationHeader()\n+ if (authHeader == null || authHeader.authScheme != AuthScheme.Bearer) return null\n+ val tokenString = when (authHeader) {\n+ is HttpAuthHeader.Single -> authHeader.blob\n+ else -> return null\n+ }\n+ return JWT.decode(tokenString)\n+}\n+\nfun verifyTokenSignature(token: DecodedJWT) {\nval jwk = jwkProvider.get(token.keyId)\nval publicKey = jwk.publicKey as? RSAPublicKey ?: throw RuntimeException(\"Invalid key type\")\n@@ -221,7 +247,9 @@ fun verifyTokenSignature(token: DecodedJWT) {\n\"RS512\" -> Algorithm.RSA512(publicKey, null)\nelse -> throw Exception(\"Unsupported Algorithm\")\n}\n- val verifier = JWT.require(algorithm).build()\n+ val verifier = JWT.require(algorithm)\n+ .acceptLeeway(60L)\n+ .build()\nverifier.verify(token)\n}\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Verify JWT expiration date |
426,496 | 21.06.2022 15:25:57 | -7,200 | 52420354bd30b3db06f9aa0a1d156df10cfc75bb | Fixed redirect after successful OAuth | [
{
"change_type": "MODIFY",
"old_path": "authorization/src/main/kotlin/org/modelix/authorization/ktor/KtorAuthUtils.kt",
"new_path": "authorization/src/main/kotlin/org/modelix/authorization/ktor/KtorAuthUtils.kt",
"diff": "@@ -101,7 +101,7 @@ fun Application.installAuthentication() {\n}\nurlProvider = {\nval forwardedUrl = request.headers[\"X-Forwarded-Url\"]\n- var originalUrl = (forwardedUrl ?:\n+ var originalUrl = (this.request.queryParameters[originalUrlParameterName] ?: forwardedUrl ?:\n\"\"\"${request.origin.scheme}://${request.host()}:${request.port()}${request.uri}\"\"\").substringBefore(\"?\")\nval pathPrefix = if (forwardedUrl == null) \"\" else {\nval forwardedPath = \"/\" + forwardedUrl.substringBefore(\"?\").substringAfter(\"://\").substringAfter(\"/\")\n@@ -145,7 +145,7 @@ fun Application.installAuthentication() {\nrouting {\nauthenticate(jwtAuth, sessionAuth, keycloakOAuth) {\nget(\"/$callbackEndpointName\") {\n- val originalUrl = call.parameters[\"originalUrl\"] ?: \"/\"\n+ val originalUrl = call.parameters[originalUrlParameterName] ?: \"/\"\nval token = call.getJWTAsString()\nif (token == null) {\ncall.respondText(\"Token missing\", status = HttpStatusCode.InternalServerError)\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Fixed redirect after successful OAuth |
426,496 | 22.06.2022 14:20:50 | -7,200 | 0fdc99c608aec4fabd23c59a9a30a143468de4cc | Use OAuth proxy to log in with keycloak | [
{
"change_type": "MODIFY",
"old_path": "authorization/src/main/kotlin/org/modelix/authorization/ktor/KtorAuthUtils.kt",
"new_path": "authorization/src/main/kotlin/org/modelix/authorization/ktor/KtorAuthUtils.kt",
"diff": "@@ -68,9 +68,12 @@ public fun AuthenticationConfig.oauthProxy(\nregister(provider)\n}\n+private const val SESSION_COOKIE_NAME = \"modelix-session\"\n+\nfun Application.installAuthentication() {\ninstall(XForwardedHeaders)\ninstall(Authentication) {\n+ // REST clients can provide an \"Authorization: Bearer ...\" header to get access\njwt(jwtAuth) {\nverifier(jwkProvider) {\nacceptLeeway(60L)\n@@ -80,11 +83,15 @@ fun Application.installAuthentication() {\nit.payload.toUser()\n}\n}\n+ // After a successful OAuth login store the token in a cookie. The token is signed and can be verified without\n+ // any state on the ktor server and without any request to the OIDC server.\nsession<UserSession>(sessionAuth) {\n- this.validate {\n+ validate {\nit.getJWT().nullIfInvalid()?.toUser()\n}\n}\n+ // If no authentication data is provided redirect to keycloak and let the user login. Keycloak may remember the\n+ // user and immediately redirect without showing any UI.\noauth(keycloakOAuth) {\nclient = HttpClient(CIO)\nproviderLookup = {\n@@ -93,9 +100,9 @@ fun Application.installAuthentication() {\nauthorizeUrl = \"http://${request.host()}:${request.port()}/realms/$KEYCLOAK_REALM/protocol/openid-connect/auth\",\naccessTokenUrl = \"http://$KEYCLOAK_INTERNAL_HOST/realms/$KEYCLOAK_REALM/protocol/openid-connect/token\",\nclientId = KEYCLOAK_CLIENT,\n- clientSecret = \"VkD4oEhsGQyUCCEyO1ZHgTUV1BLp3gLl\",\n+ clientSecret = \"9MMUb1aWd9uCKJZ4cfoXCbTx3bgpyJPi\", // TODO make configurable\naccessTokenRequiresBasicAuth = false,\n- requestMethod = HttpMethod.Post, // must POST to token endpoint\n+ requestMethod = HttpMethod.Post,\ndefaultScopes = listOf(\"roles\")\n)\n}\n@@ -112,6 +119,18 @@ fun Application.installAuthentication() {\n\"\"\"${request.origin.scheme}://${request.host()}:${request.port()}$pathPrefix/$callbackEndpointName?$originalUrlParameterName=$originalUrl\"\"\"\n}\n}\n+\n+ // If OAuth fails because of an invalid client secret a 401 is returned instead of a 500.\n+ // This provider returns the correct status code with a description.\n+ register(object : AuthenticationProvider(object : AuthenticationProvider.Config(\"errorHandler\") {}) {\n+ override suspend fun onAuthenticate(context: AuthenticationContext) {\n+ val error = context.allErrors.firstOrNull()\n+ if (error != null) {\n+ throw RuntimeException(error.message)\n+ }\n+ }\n+\n+ })\n}\ninstall(StatusPages) {\nexception<Throwable> { call, cause ->\n@@ -132,20 +151,21 @@ fun Application.installAuthentication() {\n}\n}\ninstall(Sessions) {\n- cookie<UserSession>(\"modelix-jwt\") {\n+ cookie<UserSession>(SESSION_COOKIE_NAME) {\ncookie.path = \"/\"\ncookie.maxAgeInSeconds = 14*24*60*60\ncookie.httpOnly = false\n- serializer = object : SessionSerializer<UserSession> {\n- override fun deserialize(text: String) = UserSession(text)\n- override fun serialize(session: UserSession) = session.token\n- }\n+// serializer = object : SessionSerializer<UserSession> {\n+// override fun deserialize(text: String) = UserSession(text)\n+// override fun serialize(session: UserSession) = session.token\n+// }\n}\n}\nrouting {\nauthenticate(jwtAuth, sessionAuth, keycloakOAuth) {\nget(\"/$callbackEndpointName\") {\nval originalUrl = call.parameters[originalUrlParameterName] ?: \"/\"\n+ val oauthResponse = call.principal<OAuthAccessTokenResponse.OAuth2>()\nval token = call.getJWTAsString()\nif (token == null) {\ncall.respondText(\"Token missing\", status = HttpStatusCode.InternalServerError)\n@@ -155,19 +175,25 @@ fun Application.installAuthentication() {\ncall.respondText(\"Token invalid: $token\", status = HttpStatusCode.InternalServerError)\nreturn@get\n}\n- call.sessions.set(UserSession(token))\n+ call.sessions.set(SESSION_COOKIE_NAME, UserSession(token, oauthResponse?.refreshToken))\ncall.respondRedirect(originalUrl)\n}\nget(\"/user\") {\n- var jwtString = call.getJWTAsString()\n+ val jwtString = call.getJWTAsString()\nif (jwtString == null) {\ncall.respondText(\"No token available\")\n} else {\n+ val refreshToken = call.principal<OAuthAccessTokenResponse.OAuth2>()?.refreshToken\n+ ?: call.sessions.get<UserSession>()?.refreshToken\nval claims = JWT.decode(jwtString).claims.map { \"${it.key}: ${it.value}\" }.joinToString(\"\\n\")\ncall.respondText(\"\"\"\n- |Token: ${jwtString}\n+ |User: ${getUser()}\n+ |\n+ |Token: $jwtString\n+ |Refresh Token: $refreshToken\n|\n- |$claims\"\"\".trimMargin())\n+ |$claims\n+ |\"\"\".trimMargin())\n}\n}\n}\n@@ -175,7 +201,7 @@ fun Application.installAuthentication() {\n}\n-data class UserSession(val token: String) {\n+data class UserSession(val token: String, val refreshToken: String?) {\nfun getJWT(): DecodedJWT = JWT.decode(token)\nfun getUser(): AuthenticatedUser? = getJWT().nullIfInvalid()?.toUser()\n}\n@@ -204,10 +230,7 @@ fun ApplicationCall.getUser(): AuthenticatedUser {\nfun Payload?.toUser(): AuthenticatedUser? {\nval jwt = this ?: return null\nval name = jwt.getClaim(\"preferred_username\")?.asString() ?: AuthenticatedUser.ANONYMOUS_USER_ID\n- val roles = jwt.getClaim(\"realm_access\")?.asString()?.let {\n- val roles = JSONObject(it).getJSONArray(\"roles\")\n- (0 until roles.length()).map { roles.getString(it) }\n- }?.toSet() ?: emptySet()\n+ val roles = (jwt.getClaim(\"realm_access\")?.asMap()?.get(\"roles\") as? List<String>)?.toSet() ?: emptySet()\nreturn AuthenticatedUser(setOf(name), roles + AuthenticatedUser.PUBLIC_GROUP)\n}\n@@ -248,7 +271,7 @@ fun verifyTokenSignature(token: DecodedJWT) {\nelse -> throw Exception(\"Unsupported Algorithm\")\n}\nval verifier = JWT.require(algorithm)\n- .acceptLeeway(60L)\n+ .acceptLeeway(0L)\n.build()\nverifier.verify(token)\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "kubernetes/common/oauth-deployment.yaml",
"new_path": "kubernetes/common/oauth-deployment.yaml",
"diff": "@@ -27,25 +27,30 @@ spec:\n- --email-domain=*\n- --cookie-secure=false\n- --cookie-secret=jLTKkbMwRJpsS7ZW\n- - --provider=google\n- - --client-secret=G3RfPLig_e0UhROUuf45dKJ3\n- - --client-id=214800094662-35dpgqu2llmn9mr5tt2ao9d7roebmtmm.apps.googleusercontent.com\n+ - --provider=keycloak-oidc\n+ - --client-id=modelix\n+ - --client-secret=9MMUb1aWd9uCKJZ4cfoXCbTx3bgpyJPi\n+ - --redirect-url=http://localhost:32728/oauth2/callback\n+ - --oidc-issuer-url=http://localhost:32728/realms/modelix\n+ - --skip-oidc-discovery=true\n+ - --login-url=http://localhost:32728/realms/modelix/protocol/openid-connect/auth\n+ - --redeem-url=http://keycloak:8080/realms/modelix/protocol/openid-connect/token\n+ - --oidc-jwks-url=http://keycloak:8080/realms/modelix/protocol/openid-connect/certs\n+ - --insecure-oidc-allow-unverified-email=true\n+ - --insecure-oidc-skip-issuer-verification=true\n+ - --show-debug-on-error=true\n+ - --pass-access-token=true\n+ - --pass-authorization-header=true\n+ - --prefer-email-to-user=true\n+ - --provider-display-name=Modelix\n+ - --set-authorization-header=true\n+ - --set-xauthrequest=true\n+ - --silence-ping-logging=true\n- --upstream=http://proxy/\n- - --skip-auth-regex=\\/model\\/get\\/.*\n- - --skip-auth-regex=\\/model\\/getRecursively\\/.*\n- - --skip-auth-regex=\\/model\\/put\\/.*\n- - --skip-auth-regex=\\/model\\/putAll\n- - --skip-auth-regex=\\/model\\/getAll\n- - --skip-auth-regex=\\/model\\/counter\\/.*\n- - --skip-auth-regex=\\/model\\/subscribe\\/.*\n- - --skip-auth-regex=\\/model\\/getEmail\n- - --skip-auth-regex=^\\/$\n+ - --skip-auth-regex=\\/(resources|admin|js|realms|keycloak)\\/.*\n+ - --skip-provider-button=true\n- --http-address=0.0.0.0:4180\n- --pass-user-headers=true\n- volumeMounts:\n- - name: sslcert\n- mountPath: /secrets/sslcert\n- readOnly: true\nreadinessProbe:\nhttpGet:\npath: /ping\n@@ -68,7 +73,3 @@ spec:\ncpu: 100m\nlimits:\nmemory: \"200Mi\"\n\\ No newline at end of file\n- volumes:\n- - name: sslcert\n- secret:\n- secretName: sslcert\n\\ No newline at end of file\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Use OAuth proxy to log in with keycloak |
426,496 | 22.06.2022 18:39:52 | -7,200 | eb9ff477c8ec6655ebe0d7f29b2a1864e7fad059 | Service accounts for workspace/instances manager | [
{
"change_type": "MODIFY",
"old_path": "authorization/src/main/kotlin/org/modelix/authorization/ModelServerAuthorizationPersistence.kt",
"new_path": "authorization/src/main/kotlin/org/modelix/authorization/ModelServerAuthorizationPersistence.kt",
"diff": "@@ -16,6 +16,7 @@ package org.modelix.authorization\nimport kotlinx.serialization.decodeFromString\nimport kotlinx.serialization.encodeToString\nimport kotlinx.serialization.json.Json\n+import org.modelix.authorization.ktor.serviceAccountTokenProvider\nimport org.modelix.model.IKeyListener\nimport org.modelix.model.client.IModelClient\nimport org.modelix.model.client.RestWebModelClient\n@@ -33,7 +34,7 @@ class ModelServerAuthorizationPersistence(val client: IModelClient, val dataKey:\nprivate var cachedData: AuthorizationData? = null\nconstructor(modelServerUrl: String?, dataKey: String)\n- : this(RestWebModelClient(modelServerUrl ?: getModelServerUrl()), dataKey)\n+ : this(RestWebModelClient(modelServerUrl ?: getModelServerUrl(), authTokenProvider = serviceAccountTokenProvider), dataKey)\nconstructor() : this(null, \"authorization-data\")\nconstructor(client: IModelClient) : this(client, \"authorization-data\")\n"
},
{
"change_type": "MODIFY",
"old_path": "authorization/src/main/kotlin/org/modelix/authorization/ktor/KtorAuthUtils.kt",
"new_path": "authorization/src/main/kotlin/org/modelix/authorization/ktor/KtorAuthUtils.kt",
"diff": "@@ -18,6 +18,11 @@ import com.auth0.jwt.JWT\nimport com.auth0.jwt.algorithms.Algorithm\nimport com.auth0.jwt.interfaces.DecodedJWT\nimport com.auth0.jwt.interfaces.Payload\n+import io.ktor.client.*\n+import io.ktor.client.engine.cio.*\n+import io.ktor.client.request.*\n+import io.ktor.client.request.forms.*\n+import io.ktor.client.statement.*\nimport io.ktor.http.*\nimport io.ktor.http.auth.*\nimport io.ktor.server.application.*\n@@ -28,15 +33,21 @@ import io.ktor.server.plugins.statuspages.*\nimport io.ktor.server.response.*\nimport io.ktor.server.routing.*\nimport io.ktor.util.pipeline.*\n+import kotlinx.coroutines.runBlocking\n+import org.json.JSONObject\nimport org.modelix.authorization.*\nimport java.net.URL\nimport java.security.interfaces.RSAPublicKey\n+import java.util.*\n+import kotlin.collections.HashMap\n+import kotlin.collections.HashSet\nprivate const val jwtAuth = \"jwtAuth\"\nprivate const val KEYCLOAK_INTERNAL_HOST = \"keycloak:8080\"\nprivate const val KEYCLOAK_REALM = \"modelix\"\nprivate const val KEYCLOAK_CLIENT = \"modelix\"\nprivate val jwkProvider = JwkProviderBuilder(URL(\"http://$KEYCLOAK_INTERNAL_HOST/realms/$KEYCLOAK_REALM/protocol/openid-connect/certs\")).build()\n+private val httpClient = HttpClient(CIO)\nfun Application.installAuthentication() {\ninstall(XForwardedHeaders)\n@@ -181,3 +192,39 @@ fun DecodedJWT.nullIfInvalid(): DecodedJWT? {\nnull\n}\n}\n+\n+private suspend fun queryServiceAccountToken(credentials: ServiceAccountCredentials): String {\n+ val response = httpClient.submitForm(\n+ url = \"http://keycloak:8080/realms/${credentials.clientName}/protocol/openid-connect/token\",\n+ formParameters = Parameters.build {\n+ append(\"grant_type\", \"client_credentials\")\n+ }\n+ ) {\n+ basicAuth(credentials.clientName, credentials.clientSecret)\n+ }\n+ val json = JSONObject(response.bodyAsText())\n+ return json.getString(\"access_token\")\n+}\n+\n+data class ServiceAccountCredentials(val clientSecret: String, val clientName: String = \"modelix\")\n+\n+private val cachedTokens: MutableMap<ServiceAccountCredentials, String> = HashMap()\n+suspend fun getServiceAccountToken(credentials: ServiceAccountCredentials): String {\n+ var tokenString = cachedTokens[credentials]\n+ val validToken = tokenString?.let { JWT.decode(it) }?.nullIfInvalid()\n+ if (validToken == null || validToken.expiresAt.before(Date(Date().time + 60))) {\n+ tokenString = queryServiceAccountToken(credentials)\n+ cachedTokens[credentials] = tokenString\n+ }\n+ return tokenString!!\n+}\n+\n+fun getServiceAccountTokenBlocking(credentials: ServiceAccountCredentials): String {\n+ return runBlocking { getServiceAccountToken(credentials) }\n+}\n+val serviceAccountTokenProvider: ()->String = {\n+ val varName = \"CLIENT_SECRET\"\n+ val clientSecret = listOfNotNull(System.getProperty(varName), System.getenv(varName)).firstOrNull()\n+ ?: throw Exception(\"Variable $varName is not specified\")\n+ getServiceAccountTokenBlocking(ServiceAccountCredentials(clientSecret))\n+}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "kubernetes/common/instances-manager-deployment.yaml",
"new_path": "kubernetes/common/instances-manager-deployment.yaml",
"diff": "@@ -28,6 +28,8 @@ spec:\nenv:\n- name: model_server_url\nvalue: http://model:28101/\n+ - name: CLIENT_SECRET\n+ value: 9MMUb1aWd9uCKJZ4cfoXCbTx3bgpyJPi\nports:\n- containerPort: 33332\n- containerPort: 5005\n"
},
{
"change_type": "MODIFY",
"old_path": "kubernetes/common/workspace-manager-deployment.yaml",
"new_path": "kubernetes/common/workspace-manager-deployment.yaml",
"diff": "@@ -25,7 +25,9 @@ spec:\n- env:\n- name: model_server_url\nvalue: http://model:28101/\n- image: modelix/modelix-workspace-manager:2020.3.5-202202031754-SNAPSHOT\n+ - name: CLIENT_SECRET\n+ value: 9MMUb1aWd9uCKJZ4cfoXCbTx3bgpyJPi\n+ image: modelix/modelix-workspace-manager:2020.3.5-202206221832-SNAPSHOT\nimagePullPolicy: IfNotPresent\nname: workspace-manager\nports:\n"
},
{
"change_type": "MODIFY",
"old_path": "model-client/src/jvmMain/kotlin/org/modelix/model/client/RestWebModelClient.kt",
"new_path": "model-client/src/jvmMain/kotlin/org/modelix/model/client/RestWebModelClient.kt",
"diff": "@@ -67,7 +67,7 @@ interface ConnectionListener {\n*/\nclass RestWebModelClient @JvmOverloads constructor(\nvar baseUrl: String? = null,\n- authToken_: String? = null,\n+ val authTokenProvider: (()->String?)? = null,\ninitialConnectionListeners: List<ConnectionListener> = emptyList()\n) : IModelClient {\n@@ -145,7 +145,7 @@ class RestWebModelClient @JvmOverloads constructor(\n@get:Synchronized\noverride lateinit var idGenerator: IIdGenerator\nprivate set\n- private var authToken = authToken_ ?: defaultToken\n+ fun getAuthToken(): String? = authTokenProvider?.invoke() ?: defaultToken\noverride fun toString() = \"RestWebModelClient($baseUrl)\"\n@@ -254,10 +254,6 @@ class RestWebModelClient @JvmOverloads constructor(\nreturn result\n}\n- fun setAuthToken(token: String?) {\n- authToken = token\n- }\n-\nval email: String\nget() {\nval response = client.target(baseUrl + \"getEmail\").request().buildGet().invoke()\n@@ -465,11 +461,17 @@ class RestWebModelClient @JvmOverloads constructor(\n.connectTimeout(1000, TimeUnit.MILLISECONDS)\n.executorService(requestExecutor)\n// .readTimeout(1000, TimeUnit.MILLISECONDS)\n- .register(ClientRequestFilter { ctx -> ctx.headers.add(HttpHeaders.AUTHORIZATION, \"Bearer $authToken\") }).build()\n+ .register(ClientRequestFilter { ctx ->\n+ val token = getAuthToken()\n+ if (token != null) ctx.headers.add(HttpHeaders.AUTHORIZATION, \"Bearer $token\")\n+ }).build()\npollingClient = ClientBuilder.newBuilder()\n.connectTimeout(1000, TimeUnit.MILLISECONDS)\n.executorService(pollingExecutor)\n- .register(ClientRequestFilter { ctx -> ctx.headers.add(HttpHeaders.AUTHORIZATION, \"Bearer $authToken\") }).build()\n+ .register(ClientRequestFilter { ctx ->\n+ val token = getAuthToken()\n+ if (token != null) ctx.headers.add(HttpHeaders.AUTHORIZATION, \"Bearer $token\")\n+ }).build()\nidGenerator = IdGenerator(clientId)\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "workspace-manager/src/main/kotlin/org/modelix/workspace/manager/WorkspaceManagerModule.kt",
"new_path": "workspace-manager/src/main/kotlin/org/modelix/workspace/manager/WorkspaceManagerModule.kt",
"diff": "package org.modelix.workspace.manager\nimport com.charleskorn.kaml.Yaml\n-import io.ktor.server.application.*\n-import io.ktor.server.html.*\n-import io.ktor.server.plugins.cors.*\nimport io.ktor.http.*\nimport io.ktor.http.content.*\n+import io.ktor.server.application.*\nimport io.ktor.server.auth.*\n-import io.ktor.server.plugins.statuspages.*\n+import io.ktor.server.html.*\n+import io.ktor.server.plugins.cors.routing.*\nimport io.ktor.server.request.*\nimport io.ktor.server.response.*\nimport io.ktor.server.routing.*\n-import kotlinx.html.body\n-import kotlinx.html.style\n-import kotlinx.html.title\nimport kotlinx.html.*\nimport kotlinx.serialization.decodeFromString\nimport kotlinx.serialization.encodeToString\nimport org.apache.commons.io.FileUtils\nimport org.apache.commons.text.StringEscapeUtils\n-import org.modelix.authorization.*\n+import org.modelix.authorization.AuthenticatedUser\n+import org.modelix.authorization.EPermissionType\n+import org.modelix.authorization.ModelixAuthorization\n+import org.modelix.authorization.PermissionId\nimport org.modelix.authorization.ktor.installAuthentication\n-import org.modelix.authorization.ktor.oauthProxy\nimport org.modelix.authorization.ktor.requiresPermission\nimport org.modelix.gitui.GIT_REPO_DIR_ATTRIBUTE_KEY\nimport org.modelix.gitui.MPS_INSTANCE_URL_ATTRIBUTE_KEY\n"
},
{
"change_type": "MODIFY",
"old_path": "workspaces/build.gradle.kts",
"new_path": "workspaces/build.gradle.kts",
"diff": "@@ -12,4 +12,5 @@ dependencies {\nimplementation(\"org.apache.commons:commons-text:1.9\")\nimplementation(\"org.jasypt:jasypt:1.9.3\")\nimplementation(project(\":model-client\", configuration = \"jvmRuntimeElements\"))\n+ implementation(project(\":authorization\"))\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "workspaces/src/main/kotlin/org/modelix/workspaces/WorkspacePersistence.kt",
"new_path": "workspaces/src/main/kotlin/org/modelix/workspaces/WorkspacePersistence.kt",
"diff": "@@ -16,14 +16,14 @@ package org.modelix.workspaces\nimport kotlinx.serialization.decodeFromString\nimport kotlinx.serialization.encodeToString\nimport kotlinx.serialization.json.Json\n-import org.apache.commons.io.FileUtils\n+import org.modelix.authorization.ktor.serviceAccountTokenProvider\nimport org.modelix.model.client.RestWebModelClient\nimport org.modelix.model.persistent.HashUtil\nimport org.modelix.model.persistent.SerializationUtil\n-class WorkspacePersistence {\n+class WorkspacePersistence() {\nprivate val WORKSPACE_LIST_KEY = \"workspaces\"\n- private val modelClient: RestWebModelClient = RestWebModelClient(getModelServerUrl())\n+ private val modelClient: RestWebModelClient = RestWebModelClient(getModelServerUrl(), authTokenProvider = serviceAccountTokenProvider)\nfun generateId(): String = SerializationUtil.longToHex(modelClient.idGenerator.generate())\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Service accounts for workspace/instances manager |
426,496 | 24.06.2022 09:50:16 | -7,200 | ab9158e03f3fa67c99519bc5108bb00605581042 | Bigger list boxes when assigning permissions | [
{
"change_type": "MODIFY",
"old_path": "authorization-ui/src/main/kotlin/org/modelix/authorization/ui/AuthorizationModule.kt",
"new_path": "authorization-ui/src/main/kotlin/org/modelix/authorization/ui/AuthorizationModule.kt",
"diff": "@@ -130,6 +130,7 @@ fun Route.authorizationRouting() {\nname = \"userOrGroupId\"\nform = \"grantPermissionForm\"\nmultiple = true\n+ size = \"20\"\nfor (userOrGroup in data.knownUsers + data.knownGroups) {\noption {\nvalue = userOrGroup\n@@ -143,6 +144,7 @@ fun Route.authorizationRouting() {\nname = \"type\"\nform = \"grantPermissionForm\"\nmultiple = true\n+ size = \"20\"\nfor (type in EPermissionType.values()) {\noption {\nvalue = type.name\n@@ -156,6 +158,7 @@ fun Route.authorizationRouting() {\nname = \"permission\"\nform = \"grantPermissionForm\"\nmultiple = true\n+ size = \"20\"\nfor (permission in data.knownPermissions) {\noption {\nvalue = permission.id\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Bigger list boxes when assigning permissions |
426,496 | 24.06.2022 09:50:58 | -7,200 | aebb76f423151fefc41522fe43c74bc3583a28b8 | Mutex around service account token cache | [
{
"change_type": "MODIFY",
"old_path": "authorization/src/main/kotlin/org/modelix/authorization/ktor/KtorAuthUtils.kt",
"new_path": "authorization/src/main/kotlin/org/modelix/authorization/ktor/KtorAuthUtils.kt",
"diff": "@@ -34,6 +34,8 @@ import io.ktor.server.response.*\nimport io.ktor.server.routing.*\nimport io.ktor.util.pipeline.*\nimport kotlinx.coroutines.runBlocking\n+import kotlinx.coroutines.sync.Mutex\n+import kotlinx.coroutines.sync.withLock\nimport org.json.JSONObject\nimport org.modelix.authorization.*\nimport java.net.URL\n@@ -147,7 +149,7 @@ fun Payload?.toUser(): AuthenticatedUser? {\nval roles = (resource2roles.value as? Map<String, Object>).readRolesArray()\nroles.map { \"resources/$resource/$it\" }\n}?.toSet() ?: emptySet()\n- roles += jwt.getClaim(\"groups\")?.asList(String::class.java) ?: emptyList()\n+ roles += jwt.getClaim(\"groups\")?.asList(String::class.java)?.map { \"groups/\" + it.trimStart('/') } ?: emptyList()\nreturn AuthenticatedUser(setOf(name), roles + AuthenticatedUser.PUBLIC_GROUP)\n}\n@@ -209,7 +211,9 @@ private suspend fun queryServiceAccountToken(credentials: ServiceAccountCredenti\ndata class ServiceAccountCredentials(val clientSecret: String, val clientName: String = \"modelix\")\nprivate val cachedTokens: MutableMap<ServiceAccountCredentials, String> = HashMap()\n+private val cachedTokensMutex = Mutex()\nsuspend fun getServiceAccountToken(credentials: ServiceAccountCredentials): String {\n+ cachedTokensMutex.withLock {\nvar tokenString = cachedTokens[credentials]\nval validToken = tokenString?.let { JWT.decode(it) }?.nullIfInvalid()\nif (validToken == null || validToken.expiresAt.before(Date(Date().time + 60))) {\n@@ -218,6 +222,7 @@ suspend fun getServiceAccountToken(credentials: ServiceAccountCredentials): Stri\n}\nreturn tokenString!!\n}\n+}\nfun getServiceAccountTokenBlocking(credentials: ServiceAccountCredentials): String {\nreturn runBlocking { getServiceAccountToken(credentials) }\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Mutex around service account token cache |
426,496 | 28.06.2022 09:29:42 | -7,200 | 5217712aae2d885f7cd63df052f780e56f710b50 | Manage permissions with keycloak | [
{
"change_type": "MODIFY",
"old_path": "authorization-ui/src/main/kotlin/org/modelix/authorization/ui/AuthorizationModule.kt",
"new_path": "authorization-ui/src/main/kotlin/org/modelix/authorization/ui/AuthorizationModule.kt",
"diff": "@@ -131,7 +131,7 @@ fun Route.authorizationRouting() {\nform = \"grantPermissionForm\"\nmultiple = true\nsize = \"20\"\n- for (userOrGroup in data.knownUsers + data.knownGroups) {\n+ for (userOrGroup in data.knownUsers.sorted() + data.knownGroups.sorted()) {\noption {\nvalue = userOrGroup\n+userOrGroup\n@@ -159,7 +159,7 @@ fun Route.authorizationRouting() {\nform = \"grantPermissionForm\"\nmultiple = true\nsize = \"20\"\n- for (permission in data.knownPermissions) {\n+ for (permission in data.knownPermissions.sortedBy { it.id }) {\noption {\nvalue = permission.id\n+permission.id\n"
},
{
"change_type": "MODIFY",
"old_path": "authorization/build.gradle.kts",
"new_path": "authorization/build.gradle.kts",
"diff": "@@ -8,6 +8,7 @@ plugins {\ndependencies {\nimplementation(\"org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2\")\nimplementation(\"com.charleskorn.kaml:kaml:0.40.0\")\n+ implementation(\"org.keycloak:keycloak-authz-client:18.0.1\")\nval ktorVersion = \"2.0.2\"\nimplementation(\"io.ktor:ktor-server-auth:$ktorVersion\")\nimplementation(\"io.ktor:ktor-server-status-pages:$ktorVersion\")\n"
},
{
"change_type": "MODIFY",
"old_path": "authorization/src/main/kotlin/org/modelix/authorization/AuthenticatedUser.kt",
"new_path": "authorization/src/main/kotlin/org/modelix/authorization/AuthenticatedUser.kt",
"diff": "@@ -15,7 +15,7 @@ package org.modelix.authorization\nimport io.ktor.server.auth.*\n-class AuthenticatedUser(val userIds: Set<String>, val groups: Set<String>) : Principal {\n+class AuthenticatedUser(val userIds: Set<String>, val groups: Set<String>, val jwt: String?) : Principal {\nfun getUserAndGroupIds(): Sequence<String> = userIds.asSequence() + groups\noverride fun toString(): String {\n@@ -34,7 +34,7 @@ class AuthenticatedUser(val userIds: Set<String>, val groups: Set<String>) : Pri\ncompanion object {\nval PUBLIC_GROUP = \"modelix-public\"\nval ANONYMOUS_USER_ID = \"modelix-anonymous\"\n- val ANONYMOUS_USER = AuthenticatedUser(setOf(ANONYMOUS_USER_ID), setOf(PUBLIC_GROUP))\n+ val ANONYMOUS_USER = AuthenticatedUser(setOf(ANONYMOUS_USER_ID), setOf(PUBLIC_GROUP), null)\nfun fromHttpHeaders(headers: List<Pair<String, String>>): AuthenticatedUser {\nvar users = headers.filter { it.first == \"X-Forwarded-Email\" || it.first == \"X-Forwarded-User\" }.map { it.second }\n@@ -43,7 +43,7 @@ class AuthenticatedUser(val userIds: Set<String>, val groups: Set<String>) : Pri\nusers = listOf(ANONYMOUS_USER_ID)\n}\ngroups += PUBLIC_GROUP\n- return AuthenticatedUser(users.toSet(), groups.toSet())\n+ return AuthenticatedUser(users.toSet(), groups.toSet(), null)\n}\nfun fromHttpHeaders(headers: Iterable<Map.Entry<String, List<String>>>): AuthenticatedUser {\nreturn fromHttpHeaders(headers.flatMap { entry -> entry.value.map { value -> entry.key to value } })\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "authorization/src/main/kotlin/org/modelix/authorization/KeycloakUtils.kt",
"diff": "+/*\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.modelix.authorization\n+\n+import com.auth0.jwt.interfaces.DecodedJWT\n+import org.keycloak.authorization.client.AuthzClient\n+import org.keycloak.authorization.client.Configuration\n+import org.keycloak.representations.idm.authorization.AuthorizationRequest\n+import org.keycloak.representations.idm.authorization.Permission\n+import org.keycloak.representations.idm.authorization.PermissionRequest\n+import org.modelix.authorization.ktor.getClientSecret\n+\n+object KeycloakUtils {\n+ val authzClient = AuthzClient.create(Configuration(\n+ \"http://172.16.2.56:31310/\",\n+ \"modelix\",\n+ \"modelix\",\n+ mapOf(\"secret\" to getClientSecret()),\n+ null\n+ ))\n+\n+ fun getPermissions(accessToken: DecodedJWT): List<Permission> {\n+ try {\n+ val rpt = authzClient.authorization(accessToken.token).authorize(AuthorizationRequest()).token\n+ val introspect = authzClient.protection().introspectRequestingPartyToken(rpt)\n+ return introspect.permissions\n+ } catch (e: Exception) {\n+ throw RuntimeException(\"Can't get permissions for token: ${accessToken.token}\", e)\n+ }\n+ }\n+\n+ fun hasPermissions(accessToken: DecodedJWT, permissionNames: List<String>): Boolean {\n+ try {\n+ val ticket = authzClient.protection(accessToken.token).permission().create(permissionNames.map { PermissionRequest(it) }).ticket\n+ val rpt = authzClient.authorization(accessToken.token).authorize(AuthorizationRequest(ticket)).token\n+ val introspect = authzClient.protection().introspectRequestingPartyToken(rpt)\n+ return introspect.active\n+ } catch (e: Exception) {\n+ throw RuntimeException(\"Can't get permissions for token: ${accessToken.token}\", e)\n+ }\n+ }\n+\n+}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "authorization/src/main/kotlin/org/modelix/authorization/ktor/KtorAuthUtils.kt",
"new_path": "authorization/src/main/kotlin/org/modelix/authorization/ktor/KtorAuthUtils.kt",
"diff": "@@ -30,6 +30,7 @@ import io.ktor.server.auth.*\nimport io.ktor.server.auth.jwt.*\nimport io.ktor.server.plugins.forwardedheaders.*\nimport io.ktor.server.plugins.statuspages.*\n+import io.ktor.server.request.*\nimport io.ktor.server.response.*\nimport io.ktor.server.routing.*\nimport io.ktor.util.pipeline.*\n@@ -45,7 +46,7 @@ import kotlin.collections.HashMap\nimport kotlin.collections.HashSet\nprivate const val jwtAuth = \"jwtAuth\"\n-private const val KEYCLOAK_INTERNAL_HOST = \"keycloak:8080\"\n+private const val KEYCLOAK_INTERNAL_HOST = \"172.16.2.56:31310\"\nprivate const val KEYCLOAK_REALM = \"modelix\"\nprivate const val KEYCLOAK_CLIENT = \"modelix\"\nprivate val jwkProvider = JwkProviderBuilder(URL(\"http://$KEYCLOAK_INTERNAL_HOST/realms/$KEYCLOAK_REALM/protocol/openid-connect/certs\")).build()\n@@ -63,6 +64,15 @@ fun Application.installAuthentication() {\ncall.respond(status = HttpStatusCode.Unauthorized, \"No or invalid JWT token provided\")\n} // login and token generation is done by OAuth proxy. Only validation is required here.\nvalidate {\n+ try {\n+ // OAuth proxy passes the ID token as the bearer token, but we need the access token\n+ val token = request.header(\"X-Forwarded-Access-Token\")\n+ ?: this.getBearerToken()\n+ if (token != null) {\n+ return@validate JWT.decode(token).nullIfInvalid().toUser()\n+ }\n+ } catch (e : Exception) {\n+ }\nit.payload.toUser()\n}\n}\n@@ -88,8 +98,7 @@ fun Application.installAuthentication() {\nrouting {\nauthenticate(jwtAuth) {\nget(\"/user\") {\n- val user = call.principal<AuthenticatedUser>()\n- val jwt = call.jwtFromAuthHeader()\n+ val jwt = call.principal<AuthenticatedUser>()?.jwt?.let { JWT.decode(it) } ?: call.jwtFromHeaders()\nif (jwt == null) {\ncall.respondText(\"No JWT token available\")\n} else {\n@@ -108,6 +117,9 @@ fun Application.installAuthentication() {\n|Validation result: $validationError\n|\n|$claims\n+ |\n+ |Permissions:\n+ |${KeycloakUtils.getPermissions(jwt).joinToString(\"\\n\") { \" $it\" }}\n|\"\"\".trimMargin())\n}\n}\n@@ -150,7 +162,7 @@ fun Payload?.toUser(): AuthenticatedUser? {\nroles.map { \"resources/$resource/$it\" }\n}?.toSet() ?: emptySet()\nroles += jwt.getClaim(\"groups\")?.asList(String::class.java)?.map { \"groups/\" + it.trimStart('/') } ?: emptyList()\n- return AuthenticatedUser(setOf(name), roles + AuthenticatedUser.PUBLIC_GROUP)\n+ return AuthenticatedUser(setOf(name), roles + AuthenticatedUser.PUBLIC_GROUP, (this as? DecodedJWT)?.token)\n}\nprivate fun Map<String, Any>?.readRolesArray(): List<String> {\n@@ -167,8 +179,8 @@ fun ApplicationCall.getBearerToken(): String? {\nreturn tokenString\n}\n-fun ApplicationCall.jwtFromAuthHeader(): DecodedJWT? {\n- return getBearerToken()?.let { JWT.decode(it) }\n+fun ApplicationCall.jwtFromHeaders(): DecodedJWT? {\n+ return (request.header(\"X-Forwarded-Access-Token\") ?: getBearerToken())?.let { JWT.decode(it) }\n}\nfun verifyTokenSignature(token: DecodedJWT) {\n@@ -197,7 +209,7 @@ fun DecodedJWT.nullIfInvalid(): DecodedJWT? {\nprivate suspend fun queryServiceAccountToken(credentials: ServiceAccountCredentials): String {\nval response = httpClient.submitForm(\n- url = \"http://keycloak:8080/realms/${credentials.clientName}/protocol/openid-connect/token\",\n+ url = \"http://$KEYCLOAK_INTERNAL_HOST/realms/${credentials.clientName}/protocol/openid-connect/token\",\nformParameters = Parameters.build {\nappend(\"grant_type\", \"client_credentials\")\n}\n@@ -228,8 +240,13 @@ fun getServiceAccountTokenBlocking(credentials: ServiceAccountCredentials): Stri\nreturn runBlocking { getServiceAccountToken(credentials) }\n}\nval serviceAccountTokenProvider: ()->String = {\n+ val clientSecret = getClientSecret()\n+ getServiceAccountTokenBlocking(ServiceAccountCredentials(clientSecret))\n+}\n+\n+fun getClientSecret(): String {\nval varName = \"CLIENT_SECRET\"\nval clientSecret = listOfNotNull(System.getProperty(varName), System.getenv(varName)).firstOrNull()\n?: throw Exception(\"Variable $varName is not specified\")\n- getServiceAccountTokenBlocking(ServiceAccountCredentials(clientSecret))\n+ return clientSecret\n}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "kubernetes/common/keycloak.yaml",
"new_path": "kubernetes/common/keycloak.yaml",
"diff": "@@ -34,12 +34,14 @@ spec:\nimage: quay.io/keycloak/keycloak:18.0.1\nargs: [\"start-dev\"]\nenv:\n+ - name: KC_LOG_LEVEL\n+ value: \"DEBUG\"\n- name: KEYCLOAK_ADMIN\nvalue: \"admin\"\n- name: KEYCLOAK_ADMIN_PASSWORD\nvalue: \"admin\"\n- name: KC_PROXY\n- value: \"edge\"\n+ value: \"none\"\n- name: PROXY_ADDRESS_FORWARDING\nvalue: \"true\"\n- name: KC_DB\n@@ -50,6 +52,10 @@ spec:\nvalue: \"modelix\"\n- name: KC_DB_URL\nvalue: \"jdbc:postgresql://db:5432/\"\n+ - name: KC_HOSTNAME\n+ value: \"172.16.2.56\"\n+ - name: KC_HOSTNAME_PORT\n+ value: \"31310\"\nports:\n- name: http\ncontainerPort: 8080\n"
},
{
"change_type": "MODIFY",
"old_path": "kubernetes/common/model-deployment.yaml",
"new_path": "kubernetes/common/model-deployment.yaml",
"diff": "apiVersion: apps/v1\nkind: Deployment\nmetadata:\n- annotations:\n- creationTimestamp: null\nlabels:\napp: model\nname: model\n@@ -19,7 +17,6 @@ spec:\napp: model\ntemplate:\nmetadata:\n- creationTimestamp: null\nlabels:\napp: model\nspec:\n@@ -27,7 +24,9 @@ spec:\n- env:\n- name: jdbc_url\nvalue: jdbc:postgresql://db:5432/\n- image: modelix/modelix-model:0.0.72\n+ - name: CLIENT_SECRET\n+ value: Bz4HAIfb4X2STVGDzAi4A3fDzOvMFugL\n+ image: modelix/modelix-model:2020.3.5-202206280916-SNAPSHOT\nimagePullPolicy: IfNotPresent\nname: model\nports:\n@@ -64,4 +63,3 @@ spec:\n- name: modelsecret\nsecret:\nsecretName: modelsecret\n-status: {}\n"
},
{
"change_type": "MODIFY",
"old_path": "kubernetes/common/oauth-deployment.yaml",
"new_path": "kubernetes/common/oauth-deployment.yaml",
"diff": "@@ -31,17 +31,18 @@ spec:\n- --cookie-secret=jLTKkbMwRJpsS7ZW\n- --provider=keycloak-oidc\n- --client-id=modelix\n- - --client-secret=9MMUb1aWd9uCKJZ4cfoXCbTx3bgpyJPi\n- - --redirect-url=http://localhost:32728/oauth2/callback\n- - --oidc-issuer-url=http://localhost:32728/realms/modelix\n+ - --client-secret=Bz4HAIfb4X2STVGDzAi4A3fDzOvMFugL\n+ - --redirect-url=http://172.16.2.56:32728/oauth2/callback\n+ - --oidc-issuer-url=http://172.16.2.56:31310/realms/modelix\n- --skip-oidc-discovery=true\n- - --login-url=http://localhost:32728/realms/modelix/protocol/openid-connect/auth\n- - --redeem-url=http://keycloak:8080/realms/modelix/protocol/openid-connect/token\n- - --oidc-jwks-url=http://keycloak:8080/realms/modelix/protocol/openid-connect/certs\n+ - --login-url=http://172.16.2.56:31310/realms/modelix/protocol/openid-connect/auth\n+ - --redeem-url=http://172.16.2.56:31310/realms/modelix/protocol/openid-connect/token\n+ - --oidc-jwks-url=http://172.16.2.56:31310/realms/modelix/protocol/openid-connect/certs\n- --insecure-oidc-allow-unverified-email=true\n- --insecure-oidc-skip-issuer-verification=true\n- --show-debug-on-error=true\n- --pass-authorization-header=true\n+ - --pass-access-token=true\n- --prefer-email-to-user=true\n- --provider-display-name=Modelix\n- --set-authorization-header=true\n"
},
{
"change_type": "MODIFY",
"old_path": "kubernetes/common/workspace-manager-deployment.yaml",
"new_path": "kubernetes/common/workspace-manager-deployment.yaml",
"diff": "@@ -26,7 +26,7 @@ spec:\n- name: model_server_url\nvalue: http://model:28101/\n- name: CLIENT_SECRET\n- value: 9MMUb1aWd9uCKJZ4cfoXCbTx3bgpyJPi\n+ value: Bz4HAIfb4X2STVGDzAi4A3fDzOvMFugL\nimage: modelix/modelix-workspace-manager:2020.3.5-202206221832-SNAPSHOT\nimagePullPolicy: IfNotPresent\nname: workspace-manager\n"
},
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/kotlin/org/modelix/model/server/JsonModelServer.kt",
"new_path": "model-server/src/main/kotlin/org/modelix/model/server/JsonModelServer.kt",
"diff": "@@ -53,7 +53,7 @@ class JsonModelServer(val client: LocalModelClient) {\napplication.apply {\ninstall(WebSockets)\nrouting {\n- requiresPermission(PermissionId(\"model-json\"), EPermissionType.READ) {\n+ requiresPermission(PermissionId(\"model-json-api\"), EPermissionType.READ) {\nroute(\"/json\") {\ninitRouting()\n}\n@@ -95,6 +95,12 @@ class JsonModelServer(val client: LocalModelClient) {\n+\" it into the master branch. Return the model content after the merge.\"\n}\n}\n+ tr {\n+ td { +\"WEBSOCKET /{repositoryId}/ws\" }\n+ td {\n+ + \"WebSocket for exchanging model deltas.\"\n+ }\n+ }\n}\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/kotlin/org/modelix/model/server/Main.kt",
"new_path": "model-server/src/main/kotlin/org/modelix/model/server/Main.kt",
"diff": "@@ -274,6 +274,9 @@ object Main {\nli {\na(\"json/\") { +\"JSON API for JavaScript clients\" }\n}\n+ li {\n+ a(\"headers\") { +\"View HTTP headers\" }\n+ }\n}\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "proxy/nginx.conf",
"new_path": "proxy/nginx.conf",
"diff": "@@ -6,6 +6,7 @@ http {\nserver {\nclient_max_body_size 200M;\n+ #large_client_header_buffers 4 32k;\nresolver $NAMESERVER valid=10s;\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Manage permissions with keycloak |
426,496 | 28.06.2022 17:05:56 | -7,200 | 91ede693d54f6bdcf70adbc6c6307edd9d6d3a1e | Store OAuth proxy sessions in redis to reduce the cookie size
With ID, access and refresh tokens the cookies are getting to long for the default header size limit. | [
{
"change_type": "MODIFY",
"old_path": "kubernetes/common/oauth-deployment.yaml",
"new_path": "kubernetes/common/oauth-deployment.yaml",
"diff": "@@ -21,6 +21,26 @@ spec:\napp: oauth\nspec:\ncontainers:\n+ - image: redis:7.0.2\n+ name: redis\n+ resources:\n+ requests:\n+ memory: \"100Mi\"\n+ cpu: 100m\n+ limits:\n+ memory: \"200Mi\"\n+ readinessProbe:\n+ tcpSocket:\n+ port: 6379\n+ initialDelaySeconds: 3\n+ periodSeconds: 5\n+ timeoutSeconds: 3\n+ livenessProbe:\n+ tcpSocket:\n+ port: 6379\n+ initialDelaySeconds: 3\n+ periodSeconds: 10\n+ timeoutSeconds: 5\n- image: quay.io/oauth2-proxy/oauth2-proxy\nname: oauth2-proxy\nargs:\n@@ -29,6 +49,9 @@ spec:\n- --cookie-secure=false\n- --cookie-refresh=60s\n- --cookie-secret=jLTKkbMwRJpsS7ZW\n+ - --session-store-type=redis\n+ - --redis-connection-url=redis://localhost/\n+ - --session-cookie-minimal=false\n- --provider=keycloak-oidc\n- --client-id=modelix\n- --client-secret=Bz4HAIfb4X2STVGDzAi4A3fDzOvMFugL\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Store OAuth proxy sessions in redis to reduce the cookie size
With ID, access and refresh tokens the cookies are getting to long for the default header size limit. |
426,496 | 29.06.2022 11:25:16 | -7,200 | e08848edbd5fd372181ebbd33c6d7f63334d9cdb | Check permissions using keycloak | [
{
"change_type": "MODIFY",
"old_path": "authorization/build.gradle.kts",
"new_path": "authorization/build.gradle.kts",
"diff": "@@ -9,6 +9,7 @@ dependencies {\nimplementation(\"org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2\")\nimplementation(\"com.charleskorn.kaml:kaml:0.40.0\")\nimplementation(\"org.keycloak:keycloak-authz-client:18.0.1\")\n+ implementation(\"com.google.guava:guava:31.1-jre\")\nval ktorVersion = \"2.0.2\"\nimplementation(\"io.ktor:ktor-server-auth:$ktorVersion\")\nimplementation(\"io.ktor:ktor-server-status-pages:$ktorVersion\")\n"
},
{
"change_type": "MODIFY",
"old_path": "authorization/src/main/kotlin/org/modelix/authorization/KeycloakUtils.kt",
"new_path": "authorization/src/main/kotlin/org/modelix/authorization/KeycloakUtils.kt",
"diff": "package org.modelix.authorization\nimport com.auth0.jwt.interfaces.DecodedJWT\n+import com.google.common.cache.CacheBuilder\nimport org.keycloak.authorization.client.AuthzClient\nimport org.keycloak.authorization.client.Configuration\nimport org.keycloak.representations.idm.authorization.AuthorizationRequest\nimport org.keycloak.representations.idm.authorization.Permission\nimport org.keycloak.representations.idm.authorization.PermissionRequest\n+import org.keycloak.representations.idm.authorization.ResourceRepresentation\nimport org.modelix.authorization.ktor.getClientSecret\n+import java.util.concurrent.TimeUnit\nobject KeycloakUtils {\nval authzClient = AuthzClient.create(Configuration(\n@@ -30,7 +33,17 @@ object KeycloakUtils {\nnull\n))\n+ private val cache = CacheBuilder.newBuilder()\n+ .expireAfterWrite(1, TimeUnit.MINUTES)\n+ .build<String, List<Permission>>()\n+ private val existingResources = HashSet<String>()\n+\n+ @Synchronized\nfun getPermissions(accessToken: DecodedJWT): List<Permission> {\n+ return cache.get(accessToken.token) { queryPermissions(accessToken) }\n+ }\n+\n+ private fun queryPermissions(accessToken: DecodedJWT): List<Permission> {\ntry {\nval rpt = authzClient.authorization(accessToken.token).authorize(AuthorizationRequest()).token\nval introspect = authzClient.protection().introspectRequestingPartyToken(rpt)\n@@ -40,9 +53,23 @@ object KeycloakUtils {\n}\n}\n- fun hasPermissions(accessToken: DecodedJWT, permissionNames: List<String>): Boolean {\n+ @Synchronized\n+ fun hasPermission(accessToken: DecodedJWT, resourceName: String, scope: String): Boolean {\n+ ensureResourcesExists(resourceName)\n+ val allPermissions = getPermissions(accessToken)\n+ val forResource = allPermissions.filter { it.resourceName == resourceName }\n+ if (forResource.isEmpty()) return false\n+ val scopes: Set<String> = forResource.mapNotNull { it.scopes }.flatten().toSet()\n+ if (scopes.isEmpty()) {\n+ // If the permissions are not restricted to any scope we assume they are valid for all scopes.\n+ return true\n+ }\n+ return scopes.contains(scope)\n+ }\n+\n+ private fun hasPermissions(accessToken: DecodedJWT, resourceNames: List<String>): Boolean {\ntry {\n- val ticket = authzClient.protection(accessToken.token).permission().create(permissionNames.map { PermissionRequest(it) }).ticket\n+ val ticket = authzClient.protection(accessToken.token).permission().create(resourceNames.map { PermissionRequest(it) }).ticket\nval rpt = authzClient.authorization(accessToken.token).authorize(AuthorizationRequest(ticket)).token\nval introspect = authzClient.protection().introspectRequestingPartyToken(rpt)\nreturn introspect.active\n@@ -51,4 +78,19 @@ object KeycloakUtils {\n}\n}\n+ private fun createPermission(ownerToken: DecodedJWT?, resourceName: String): String {\n+ val protection = if (ownerToken == null) authzClient.protection() else authzClient.protection(ownerToken.token)\n+ val newResource = protection.resource().create(ResourceRepresentation(resourceName))\n+ return newResource.id\n+ }\n+\n+ @Synchronized\n+ fun ensureResourcesExists(resourceName: String) {\n+ if (existingResources.contains(resourceName)) return\n+ if (authzClient.protection().resource().findByName(resourceName) == null) {\n+ authzClient.protection().resource().create(ResourceRepresentation(resourceName))\n+ cache.invalidateAll()\n+ }\n+ existingResources += resourceName\n+ }\n}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "authorization/src/main/kotlin/org/modelix/authorization/ktor/KtorAuthUtils.kt",
"new_path": "authorization/src/main/kotlin/org/modelix/authorization/ktor/KtorAuthUtils.kt",
"diff": "@@ -131,11 +131,19 @@ fun Application.installAuthentication() {\nfun Route.requiresPermission(permission: PermissionId, type: EPermissionType, body: Route.()->Unit) {\nauthenticate(jwtAuth) {\nintercept(ApplicationCallPipeline.Call) {\n- ModelixAuthorization.checkPermission(\n- call.getUser(),\n- permission,\n- type\n- )\n+ val jwt = call.jwtFromHeaders()\n+ if (jwt == null) {\n+ call.respond(HttpStatusCode.Unauthorized, \"No JWT token found in the request headers\")\n+ return@intercept\n+ }\n+ if (!KeycloakUtils.hasPermission(jwt, permission.id, type.name)) {\n+ throw NoPermissionException(call.getUser(), permission, type)\n+ }\n+// ModelixAuthorization.checkPermission(\n+// call.getUser(),\n+// permission,\n+// type\n+// )\n}\nbody()\n}\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Check permissions using keycloak |
426,496 | 29.06.2022 16:42:22 | -7,200 | 6ee5beb43a471d83b8c740f0173ce41870b6432f | Unit test mode for the model server that doesn't check authorization | [
{
"change_type": "MODIFY",
"old_path": "authorization/src/main/kotlin/org/modelix/authorization/KtorAuthUtils.kt",
"new_path": "authorization/src/main/kotlin/org/modelix/authorization/KtorAuthUtils.kt",
"diff": "@@ -32,16 +32,15 @@ import io.ktor.server.plugins.statuspages.*\nimport io.ktor.server.request.*\nimport io.ktor.server.response.*\nimport io.ktor.server.routing.*\n+import io.ktor.util.*\nimport io.ktor.util.pipeline.*\nimport kotlinx.coroutines.runBlocking\nimport kotlinx.coroutines.sync.Mutex\nimport kotlinx.coroutines.sync.withLock\nimport org.json.JSONObject\n-import org.modelix.authorization.*\nimport java.net.URL\nimport java.security.interfaces.RSAPublicKey\nimport java.util.*\n-import kotlin.collections.HashMap\nprivate const val jwtAuth = \"jwtAuth\"\nprivate const val KEYCLOAK_INTERNAL_HOST = \"172.16.2.56:31310\"\n@@ -49,10 +48,22 @@ private const val KEYCLOAK_REALM = \"modelix\"\nprivate const val KEYCLOAK_CLIENT = \"modelix\"\nprivate val jwkProvider = JwkProviderBuilder(URL(\"http://$KEYCLOAK_INTERNAL_HOST/realms/$KEYCLOAK_REALM/protocol/openid-connect/certs\")).build()\nprivate val httpClient = HttpClient(CIO)\n+private val UNIT_TEST_MODE_KEY = AttributeKey<Boolean>(\"unit-test-mode\")\n-fun Application.installAuthentication() {\n+fun Application.installAuthentication(unitTestMode: Boolean = false) {\ninstall(XForwardedHeaders)\ninstall(Authentication) {\n+ if (unitTestMode) {\n+ register(object : AuthenticationProvider(object : Config(jwtAuth) {}) {\n+ override suspend fun onAuthenticate(context: AuthenticationContext) {\n+ context.call.attributes.put(UNIT_TEST_MODE_KEY, true)\n+ val token = JWT.create()\n+ .withClaim(\"email\", \"[email protected]\")\n+ .sign(Algorithm.HMAC256(\"unit-tests\"))\n+ context.principal(AccessTokenPrincipal(JWT.decode(token)))\n+ }\n+ })\n+ } else {\n// \"Authorization: Bearer ...\" header is provided in the header by OAuth proxy\njwt(jwtAuth) {\nverifier(jwkProvider) {\n@@ -74,12 +85,17 @@ fun Application.installAuthentication() {\n}\n}\n}\n+ }\ninstall(StatusPages) {\nexception<Throwable> { call, cause ->\nwhen (cause) {\nis NoPermissionException -> call.respondText(\ntext = cause.message ?: \"\",\n- status = io.ktor.http.HttpStatusCode.Forbidden\n+ status = HttpStatusCode.Forbidden\n+ )\n+ is NotLoggedInException -> call.respondText(\n+ text = cause.message ?: \"\",\n+ status = HttpStatusCode.Unauthorized\n)\nelse -> {\nval text = \"\"\"\n@@ -87,7 +103,7 @@ fun Application.installAuthentication() {\n|\n|${cause.stackTraceToString()}\n\"\"\".trimMargin()\n- call.respondText(text = text, status = io.ktor.http.HttpStatusCode.InternalServerError)\n+ call.respondText(text = text, status = HttpStatusCode.InternalServerError)\n}\n}\n}\n@@ -126,21 +142,17 @@ fun Application.installAuthentication() {\nfun Route.requiresPermission(resourceName: String, scope: String, body: Route.()->Unit) {\nauthenticate(jwtAuth) {\nintercept(ApplicationCallPipeline.Call) {\n- val jwt = call.principal<AccessTokenPrincipal>()?.jwt ?: call.jwtFromHeaders()\n- if (jwt == null) {\n- call.respond(HttpStatusCode.Unauthorized, \"No JWT token found in the request headers\")\n- return@intercept\n+ call.checkPermission(resourceName, scope)\n}\n- if (!KeycloakUtils.hasPermission(jwt, resourceName, scope)) {\n- throw NoPermissionException(AccessTokenPrincipal(jwt), resourceName, scope)\n+ body()\n}\n-// ModelixAuthorization.checkPermission(\n-// call.getUser(),\n-// permission,\n-// type\n-// )\n}\n- body()\n+\n+fun ApplicationCall.checkPermission(resourceName: String, scope: String) {\n+ if (attributes.getOrNull(UNIT_TEST_MODE_KEY) == true) return\n+ val principal = principal<AccessTokenPrincipal>() ?: throw NotLoggedInException()\n+ if (!KeycloakUtils.hasPermission(principal.jwt, resourceName, scope)) {\n+ throw NoPermissionException(principal, resourceName, scope)\n}\n}\n@@ -168,9 +180,7 @@ fun PipelineContext<Unit, ApplicationCall>.getUserName(): String? {\n}\nfun ApplicationCall.getUserName(): String? {\n- val principal: AccessTokenPrincipal? = (principal<AccessTokenPrincipal>()\n- ?: jwtFromHeaders()?.let { AccessTokenPrincipal(it) })\n- return principal?.getUserName()\n+ return principal<AccessTokenPrincipal>()?.getUserName()\n}\nfun verifyTokenSignature(token: DecodedJWT) {\n"
},
{
"change_type": "RENAME",
"old_path": "authorization/src/main/kotlin/org/modelix/authorization/ModelixAuthorization.kt",
"new_path": "authorization/src/main/kotlin/org/modelix/authorization/NotLoggedInException.kt",
"diff": "/*\n+ * Copyright 2003-2022 JetBrains s.r.o.\n+ *\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*/\npackage org.modelix.authorization\n-object ModelixAuthorization {\n- fun checkPermission(principal: AccessTokenPrincipal, resourceName: String, scope: String) {\n- if (!KeycloakUtils.hasPermission(principal.jwt, resourceName, scope)) {\n- throw NoPermissionException(principal, resourceName, scope)\n- }\n- }\n+class NotLoggedInException : RuntimeException(\"No valid JWT token found in the request headers\") {\n}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/kotlin/org/modelix/model/server/KtorModelServer.kt",
"new_path": "model-server/src/main/kotlin/org/modelix/model/server/KtorModelServer.kt",
"diff": "@@ -115,10 +115,6 @@ class KtorModelServer(val storeClient: IStoreClient) {\nprivate fun Application.modelServerModule() {\n- install(Routing)\n- installAuthentication()\n- install(ForwardedHeaders)\n-\nrouting {\nget(\"/health\") {\nif (isHealthy()) {\n"
},
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/kotlin/org/modelix/model/server/Main.kt",
"new_path": "model-server/src/main/kotlin/org/modelix/model/server/Main.kt",
"diff": "@@ -23,12 +23,13 @@ import io.ktor.server.application.*\nimport io.ktor.server.engine.*\nimport io.ktor.server.html.*\nimport io.ktor.server.netty.*\n+import io.ktor.server.plugins.forwardedheaders.*\nimport io.ktor.server.response.*\nimport io.ktor.server.routing.*\nimport kotlinx.html.*\nimport org.apache.commons.io.FileUtils\nimport org.apache.ignite.Ignition\n-import org.modelix.authorization.ModelixAuthorization\n+import org.modelix.authorization.installAuthentication\nimport org.slf4j.LoggerFactory\nimport java.io.File\nimport java.io.FileReader\n@@ -242,6 +243,10 @@ object Main {\nval historyHandler = HistoryHandler(localModelClient)\nval jsonModelServer = JsonModelServer(localModelClient)\nval ktorServer: NettyApplicationEngine = embeddedServer(Netty, port = port) {\n+ install(Routing)\n+ installAuthentication(unitTestMode = cmdLineArgs.inmemory)\n+ install(ForwardedHeaders)\n+\nmodelServer.init(this)\nhistoryHandler.init(this)\njsonModelServer.init(this)\n"
},
{
"change_type": "DELETE",
"old_path": "model-server/src/main/resources/application.conf",
"new_path": null,
"diff": "-ktor {\n- deployment {\n- port = 28143\n- }\n- application {\n- modules = [\n- org.modelix.authorization.ui.AuthorizationModuleKt.authorizationModule\n- ]\n- }\n-}\n"
},
{
"change_type": "MODIFY",
"old_path": "model-server/src/test/kotlin/JsonAPITest.kt",
"new_path": "model-server/src/test/kotlin/JsonAPITest.kt",
"diff": "@@ -18,6 +18,7 @@ import io.ktor.http.*\nimport io.ktor.server.testing.*\nimport org.json.JSONArray\nimport org.json.JSONObject\n+import org.modelix.authorization.installAuthentication\nimport org.modelix.model.api.ITree\nimport org.modelix.model.server.*\nimport kotlin.test.*\n@@ -25,6 +26,7 @@ import kotlin.test.*\nclass JsonAPITest {\nprivate fun runTest(block: suspend ApplicationTestBuilder.() -> Unit) = testApplication {\napplication {\n+ installAuthentication(unitTestMode = true)\nJsonModelServer(LocalModelClient(InMemoryStoreClient())).init(this)\n}\nblock()\n@@ -46,7 +48,7 @@ class JsonAPITest {\n@Test\nfun getByVersionHash() = runTest {\n- val versionHash = JSONObject(client.post(\"/json/$repoId/init\").bodyAsText()).getString(\"versionHash\")\n+ val versionHash = JSONObject(client.post(\"/json/$repoId/init\").assertOK().bodyAsText()).getString(\"versionHash\")\nval response = client.get(\"/json/$repoId/$versionHash/\")\nassertEquals(HttpStatusCode.OK, response.status)\nassertEmptyVersion(JSONObject(response.bodyAsText()))\n@@ -61,7 +63,13 @@ class JsonAPITest {\n}\nprivate suspend fun ApplicationTestBuilder.initVersion(): JSONObject {\n- return JSONObject(client.post(\"/json/$repoId/init\").bodyAsText())\n+ val response = client.post(\"/json/$repoId/init\").assertOK()\n+ return JSONObject(response.bodyAsText())\n+ }\n+\n+ fun HttpResponse.assertOK(): HttpResponse {\n+ assertEquals(HttpStatusCode.OK, status)\n+ return this\n}\nprivate suspend fun ApplicationTestBuilder.getCurrentVersionHash(): String {\n"
},
{
"change_type": "MODIFY",
"old_path": "workspace-manager/src/main/kotlin/org/modelix/workspace/manager/WorkspaceManagerModule.kt",
"new_path": "workspace-manager/src/main/kotlin/org/modelix/workspace/manager/WorkspaceManagerModule.kt",
"diff": "@@ -29,10 +29,7 @@ import kotlinx.serialization.decodeFromString\nimport kotlinx.serialization.encodeToString\nimport org.apache.commons.io.FileUtils\nimport org.apache.commons.text.StringEscapeUtils\n-import org.modelix.authorization.AccessTokenPrincipal\n-import org.modelix.authorization.ModelixAuthorization\n-import org.modelix.authorization.installAuthentication\n-import org.modelix.authorization.requiresPermission\n+import org.modelix.authorization.*\nimport org.modelix.gitui.GIT_REPO_DIR_ATTRIBUTE_KEY\nimport org.modelix.gitui.MPS_INSTANCE_URL_ATTRIBUTE_KEY\nimport org.modelix.gitui.gitui\n@@ -707,5 +704,5 @@ private fun findGitRepo(folder: File): File? {\n}\nprivate fun ApplicationCall.requiresWrite() {\n- ModelixAuthorization.checkPermission(principal()!!, \"workspaces\", \"write\")\n+ checkPermission(\"workspaces\", \"write\")\n}\n\\ No newline at end of file\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Unit test mode for the model server that doesn't check authorization |
426,496 | 01.07.2022 17:28:48 | -7,200 | 86ab3ba26bf6e5e5deddc37b5829205fc8ea6b96 | correct workspace-client deployment name is passed as env variable | [
{
"change_type": "MODIFY",
"old_path": "helm/modelix/templates/common/instances-manager-deployment.yaml",
"new_path": "helm/modelix/templates/common/instances-manager-deployment.yaml",
"diff": "@@ -36,6 +36,8 @@ spec:\nconfigMapKeyRef:\nkey: keycloak-client-secret\nname: \"{{ include \"modelix.fullname\" . }}-config\"\n+ - name: WORKSPACE_CLIENT_DEPLOYMENT_NAME\n+ value: \"{{ include \"modelix.fullname\" . }}-workspace-client\"\nports:\n- containerPort: 33332\n- containerPort: 5005\n"
},
{
"change_type": "MODIFY",
"old_path": "instances-manager/src/main/kotlin/org/modelix/instancesmanager/DeploymentManager.kt",
"new_path": "instances-manager/src/main/kotlin/org/modelix/instancesmanager/DeploymentManager.kt",
"diff": "@@ -458,7 +458,7 @@ class DeploymentManager {\nconst val KUBERNETES_NAMESPACE = \"default\"\nval INSTANCE = DeploymentManager()\nconst val PERSONAL_DEPLOYMENT_PREFIX = \"wsclt-\"\n- const val WORKSPACE_CLIENT_DEPLOYMENT_NAME = \"workspace-client\"\n+ val WORKSPACE_CLIENT_DEPLOYMENT_NAME = System.getenv(\"WORKSPACE_CLIENT_DEPLOYMENT_NAME\") ?: \"workspace-client\"\nval WORKSPACE_PATTERN = Pattern.compile(\"workspace-([a-f0-9]+)-([a-zA-Z0-9\\\\-_\\\\*]+)\")\n}\n}\n\\ No newline at end of file\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | correct workspace-client deployment name is passed as env variable |
426,496 | 01.07.2022 17:33:39 | -7,200 | e7129005f1eabd762c6761619f4e5a1cb957e22e | scripts for installing with helm | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "helm/dev.yaml",
"diff": "+imageTags.db: \"\"\n+imageTags.instancesManager: \"\"\n+imageTags.model: \"\"\n+imageTags.oauth: \"\"\n+imageTags.proxy: \"\"\n+imageTags.wsClient: \"\"\n+imageTags.wsManager: \"\"\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "helm/install.sh",
"diff": "+#!/bin/sh\n+\n+helm install dev ./modelix -f dev.yaml\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "helm/uninstall.sh",
"diff": "+#!/bin/sh\n+\n+helm uninstall dev\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "helm/upgrade.sh",
"diff": "+#!/bin/sh\n+\n+helm upgrade dev ./modelix -f dev.yaml\n\\ No newline at end of file\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | scripts for installing with helm |
426,496 | 01.07.2022 20:31:29 | -7,200 | 6bad8bb094617909525d0ec1c1a32ac6b6e0f279 | model server works | [
{
"change_type": "MODIFY",
"old_path": "authorization/src/main/kotlin/org/modelix/authorization/KeycloakUtils.kt",
"new_path": "authorization/src/main/kotlin/org/modelix/authorization/KeycloakUtils.kt",
"diff": "@@ -24,11 +24,16 @@ import org.keycloak.representations.idm.authorization.ResourceRepresentation\nimport java.util.concurrent.TimeUnit\nobject KeycloakUtils {\n+ val BASE_URL = System.getenv(\"KEYCLOAK_BASE_URL\")\n+ val REALM = System.getenv(\"KEYCLOAK_REALM\")\n+ val CLIENT_ID = System.getenv(\"KEYCLOAK_CLIENT_ID\")\n+ val CLIENT_SECRET = System.getenv(\"KEYCLOAK_CLIENT_SECRET\")\n+\nval authzClient = AuthzClient.create(Configuration(\n- \"http://172.16.2.56:31310/\",\n- \"modelix\",\n- \"modelix\",\n- mapOf(\"secret\" to getClientSecret()),\n+ BASE_URL,\n+ REALM,\n+ CLIENT_ID,\n+ mapOf(\"secret\" to CLIENT_SECRET),\nnull\n))\n"
},
{
"change_type": "MODIFY",
"old_path": "authorization/src/main/kotlin/org/modelix/authorization/KtorAuthUtils.kt",
"new_path": "authorization/src/main/kotlin/org/modelix/authorization/KtorAuthUtils.kt",
"diff": "@@ -43,10 +43,7 @@ import java.security.interfaces.RSAPublicKey\nimport java.util.*\nprivate const val jwtAuth = \"jwtAuth\"\n-private const val KEYCLOAK_INTERNAL_HOST = \"172.16.2.56:31310\"\n-private const val KEYCLOAK_REALM = \"modelix\"\n-private const val KEYCLOAK_CLIENT = \"modelix\"\n-private val jwkProvider = JwkProviderBuilder(URL(\"http://$KEYCLOAK_INTERNAL_HOST/realms/$KEYCLOAK_REALM/protocol/openid-connect/certs\")).build()\n+private val jwkProvider = JwkProviderBuilder(URL(\"${KeycloakUtils.BASE_URL}realms/${KeycloakUtils.REALM}/protocol/openid-connect/certs\")).build()\nprivate val httpClient = HttpClient(CIO)\nprivate val UNIT_TEST_MODE_KEY = AttributeKey<Boolean>(\"unit-test-mode\")\n@@ -209,7 +206,7 @@ fun DecodedJWT.nullIfInvalid(): DecodedJWT? {\nprivate suspend fun queryServiceAccountToken(credentials: ServiceAccountCredentials): String {\nval response = httpClient.submitForm(\n- url = \"http://$KEYCLOAK_INTERNAL_HOST/realms/${credentials.clientName}/protocol/openid-connect/token\",\n+ url = \"${KeycloakUtils.BASE_URL}realms/${credentials.clientName}/protocol/openid-connect/token\",\nformParameters = Parameters.build {\nappend(\"grant_type\", \"client_credentials\")\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "helm/modelix/templates/_helpers.tpl",
"new_path": "helm/modelix/templates/_helpers.tpl",
"diff": "@@ -64,3 +64,19 @@ Create the name of the service account to use\n{{- define \"modelix.externalUrl\" -}}\n{{ .Values.external.proto }}://{{ .Values.external.hostname }}:{{ .Values.external.port }}/\n{{- end }}\n+\n+{{- define \"modelix.externalKeycloakUrl\" -}}\n+{{ .Values.external.proto }}://{{ .Values.external.hostname }}:{{ .Values.external.keycloak.port }}/\n+{{- end }}\n+\n+{{- define \"modelix.keycloakEnv\" -}}\n+- name: KEYCLOAK_CLIENT_SECRET\n+ value: \"{{ .Values.keycloak.clientSecret }}\"\n+- name: KEYCLOAK_CLIENT_ID\n+ value: \"{{ .Values.keycloak.clientId }}\"\n+- name: KEYCLOAK_REALM\n+ value: \"{{ .Values.keycloak.realm }}\"\n+- name: KEYCLOAK_BASE_URL\n+ value: \"{{ include \"modelix.externalKeycloakUrl\" . }}\"\n+{{- end }}\n+\n"
},
{
"change_type": "MODIFY",
"old_path": "helm/modelix/templates/common/ingress.yaml",
"new_path": "helm/modelix/templates/common/ingress.yaml",
"diff": "@@ -5,7 +5,7 @@ metadata:\nspec:\ningressClassName: nginx\nrules:\n- - host: kubernetes.docker.internal\n+ - host: \"{{ .Values.external.hostname }}\"\nhttp:\npaths:\n- pathType: Prefix\n"
},
{
"change_type": "MODIFY",
"old_path": "helm/modelix/templates/common/keycloak-deployment.yaml",
"new_path": "helm/modelix/templates/common/keycloak-deployment.yaml",
"diff": "@@ -43,7 +43,7 @@ spec:\n- name: KC_HOSTNAME\nvalue: \"{{ .Values.external.hostname }}\"\n- name: KC_HOSTNAME_PORT\n- value: \"{{ .Values.external.port}}\"\n+ value: \"{{ .Values.external.keycloak.port}}\"\nports:\n- name: http\ncontainerPort: 8080\n"
},
{
"change_type": "MODIFY",
"old_path": "helm/modelix/templates/common/model-deployment.yaml",
"new_path": "helm/modelix/templates/common/model-deployment.yaml",
"diff": "@@ -27,8 +27,7 @@ spec:\n- env:\n- name: jdbc_url\nvalue: jdbc:postgresql://{{ include \"modelix.fullname\" . }}-db:5432/\n- - name: CLIENT_SECRET\n- value: \"{{ .Values.keycloak.clientSecret }}\"\n+ {{- include \"modelix.keycloakEnv\" . | nindent 12 }}\nimage: \"modelix/modelix-model:{{ .Values.imageTags.model | default .Chart.AppVersion }}\"\nimagePullPolicy: IfNotPresent\nname: model\n"
},
{
"change_type": "MODIFY",
"old_path": "helm/modelix/templates/common/oauth-deployment.yaml",
"new_path": "helm/modelix/templates/common/oauth-deployment.yaml",
"diff": "@@ -59,11 +59,11 @@ spec:\n- --client-id=modelix\n- --client-secret={{ .Values.keycloak.clientSecret }}\n- --redirect-url={{ include \"modelix.externalUrl\" . }}oauth2/callback\n- - --oidc-issuer-url={{ include \"modelix.externalUrl\" . }}keycloak/realms/{{ .Values.keycloak.realm }}\n+ - --oidc-issuer-url={{ include \"modelix.externalKeycloakUrl\" . }}realms/{{ .Values.keycloak.realm }}\n- --skip-oidc-discovery=true\n- - --login-url={{ include \"modelix.externalUrl\" . }}keycloak/realms/{{ .Values.keycloak.realm }}/protocol/openid-connect/auth\n- - --redeem-url={{ include \"modelix.externalUrl\" . }}keycloak/realms/{{ .Values.keycloak.realm }}/protocol/openid-connect/token\n- - --oidc-jwks-url={{ include \"modelix.externalUrl\" . }}keycloak/realms/{{ .Values.keycloak.realm }}/protocol/openid-connect/certs\n+ - --login-url={{ include \"modelix.externalKeycloakUrl\" . }}realms/{{ .Values.keycloak.realm }}/protocol/openid-connect/auth\n+ - --redeem-url={{ include \"modelix.externalKeycloakUrl\" . }}realms/{{ .Values.keycloak.realm }}/protocol/openid-connect/token\n+ - --oidc-jwks-url={{ include \"modelix.externalKeycloakUrl\" . }}realms/{{ .Values.keycloak.realm }}/protocol/openid-connect/certs\n- --insecure-oidc-allow-unverified-email=true\n- --insecure-oidc-skip-issuer-verification=true\n- --show-debug-on-error=true\n"
},
{
"change_type": "MODIFY",
"old_path": "helm/modelix/values.yaml",
"new_path": "helm/modelix/values.yaml",
"diff": "@@ -24,6 +24,8 @@ keycloak:\nexternal:\nproto: \"http\"\nhostname: \"172.16.2.53\"\n+ port: \"80\"\n+ keycloak:\nport: \"32728\"\ndb:\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | model server works |
426,496 | 03.07.2022 17:34:42 | -7,200 | 06101ddb96ede3d5af77318408ee5b1a526fcedd | keycloak configuration fixed | [
{
"change_type": "MODIFY",
"old_path": "helm/dev.yaml",
"new_path": "helm/dev.yaml",
"diff": "imageTags:\ndb: \"\"\ninstancesManager: \"\"\n- model: \"\"\n+ model: \"2020.3.5-202207012021-SNAPSHOT\"\noauth: \"\"\n- proxy: \"\"\n+ proxy: \"2020.3.5-202207012028-SNAPSHOT\"\nwsClient: \"\"\nwsManager: \"\"\nexternal:\n- hostname: \"kubernetes.docker.internal\"\n- port: \"80\"\n\\ No newline at end of file\n+ hostname: \"172.16.2.52.nip.io\"\n+ keycloak:\n+ hostname: \"kc.172.16.2.52.nip.io\"\n+keycloak:\n+ clientSecret: \"fzEj6AmIPwtKDs9D0KmWnk9CPyoLj5OS\"\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "helm/modelix/templates/_helpers.tpl",
"new_path": "helm/modelix/templates/_helpers.tpl",
"diff": "@@ -66,7 +66,7 @@ Create the name of the service account to use\n{{- end }}\n{{- define \"modelix.externalKeycloakUrl\" -}}\n-{{ .Values.external.proto }}://{{ .Values.external.hostname }}:{{ .Values.external.keycloak.port }}/\n+{{ .Values.external.proto }}://{{ .Values.external.keycloak.hostname }}:{{ .Values.external.keycloak.port }}/\n{{- end }}\n{{- define \"modelix.keycloakEnv\" -}}\n"
},
{
"change_type": "MODIFY",
"old_path": "helm/modelix/templates/common/ingress.yaml",
"new_path": "helm/modelix/templates/common/ingress.yaml",
"diff": "@@ -15,4 +15,14 @@ spec:\nport:\nnumber: 4180\npath: /\n+ - host: \"{{ .Values.external.keycloak.hostname }}\"\n+ http:\n+ paths:\n+ - pathType: Prefix\n+ backend:\n+ service:\n+ name: \"{{ include \"modelix.fullname\" . }}-keycloak\"\n+ port:\n+ number: 8080\n+ path: /\n"
},
{
"change_type": "MODIFY",
"old_path": "helm/modelix/templates/common/keycloak-deployment.yaml",
"new_path": "helm/modelix/templates/common/keycloak-deployment.yaml",
"diff": "@@ -28,10 +28,10 @@ spec:\nvalue: \"admin\"\n- name: KEYCLOAK_ADMIN_PASSWORD\nvalue: \"{{ .Values.keycloak.adminPassword }}\"\n- - name: KC_PROXY\n- value: \"none\"\n- - name: PROXY_ADDRESS_FORWARDING\n- value: \"true\"\n+ #- name: KC_PROXY\n+ # value: \"edge\"\n+ #- name: PROXY_ADDRESS_FORWARDING\n+ # value: \"true\"\n- name: KC_DB\nvalue: \"postgres\"\n- name: KC_DB_USERNAME\n@@ -40,10 +40,16 @@ spec:\nvalue: \"{{ .Values.db.password }}\"\n- name: KC_DB_URL\nvalue: \"jdbc:postgresql://{{ include \"modelix.fullname\" . }}-db:5432/\"\n- - name: KC_HOSTNAME\n- value: \"{{ .Values.external.hostname }}\"\n- - name: KC_HOSTNAME_PORT\n- value: \"{{ .Values.external.keycloak.port}}\"\n+ #- name: KC_HOSTNAME_ADMIN\n+ # value: \"kcadmin.{{ .Values.external.hostname }}\"\n+ #- name: KC_HOSTNAME\n+ # value: \"kc.{{ .Values.external.hostname }}\"\n+ #- name: KC_HOSTNAME_STRICT\n+ # value: \"true\"\n+ #- name: KC_HOSTNAME_PATH\n+ # value: \"/\"\n+ #- name: KC_HOSTNAME_PORT\n+ # value: \"{{ .Values.external.port }}\"\nports:\n- name: http\ncontainerPort: 8080\n"
},
{
"change_type": "MODIFY",
"old_path": "helm/modelix/values.yaml",
"new_path": "helm/modelix/values.yaml",
"diff": "@@ -23,10 +23,11 @@ keycloak:\nexternal:\nproto: \"http\"\n- hostname: \"172.16.2.53\"\n+ hostname: \"172.16.2.52.nip.io\"\nport: \"80\"\nkeycloak:\n- port: \"32728\"\n+ hostname: \"kc.172.16.2.52.nip.io\"\n+ port: \"80\"\ndb:\nuseGCloud: false\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | keycloak configuration fixed |
426,496 | 04.07.2022 11:45:05 | -7,200 | 3c107c8694cb3ae7ac826a0008f0486c5b4b0c98 | keycloak realm import (3) | [
{
"change_type": "MODIFY",
"old_path": "helm/modelix/keycloak-realm.json",
"new_path": "helm/modelix/keycloak-realm.json",
"diff": "]\n}\n],\n- \"policies\": [\n- {\n- \"id\": \"0274f31b-cd46-4b8b-bbc6-5f5aa62c3cab\",\n- \"name\": \"Default Policy\",\n- \"description\": \"A policy that grants access only for users within this realm\",\n- \"type\": \"js\",\n- \"logic\": \"POSITIVE\",\n- \"decisionStrategy\": \"AFFIRMATIVE\",\n- \"config\": {\n- \"code\": \"// by default, grants any permission associated with this policy\\n$evaluation.grant();\\n\"\n- }\n- },\n- {\n- \"id\": \"2f02be7b-81d0-4c1d-a5df-54625ad70060\",\n- \"name\": \"Default Permission\",\n- \"description\": \"A permission that applies to the default resource type\",\n- \"type\": \"resource\",\n- \"logic\": \"POSITIVE\",\n- \"decisionStrategy\": \"UNANIMOUS\",\n- \"config\": {\n- \"defaultResourceType\": \"urn:modelix:resources:default\",\n- \"applyPolicies\": \"[\\\"Default Policy\\\"]\"\n- }\n- }\n- ],\n+ \"policies\": [],\n\"scopes\": [],\n\"decisionStrategy\": \"UNANIMOUS\"\n}\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | keycloak realm import (3) |
426,496 | 04.07.2022 13:28:33 | -7,200 | 21921a652ef21543e17e282f8fbe6d6c18212c6c | keycloak realm import (4) | [
{
"change_type": "MODIFY",
"old_path": "helm/modelix/templates/common/keycloak-deployment.yaml",
"new_path": "helm/modelix/templates/common/keycloak-deployment.yaml",
"diff": "@@ -20,7 +20,7 @@ spec:\ncontainers:\n- name: keycloak\nimage: quay.io/keycloak/keycloak:18.0.1\n- args: [\"start-dev\"]\n+ args: [\"start-dev\", \"--import-realm\"]\nenv:\n- name: KC_LOG_LEVEL\nvalue: \"{{ .Values.keycloak.loglevel }}\"\n@@ -40,8 +40,6 @@ spec:\nvalue: \"{{ .Values.db.password }}\"\n- name: KC_DB_URL\nvalue: \"jdbc:postgresql://{{ include \"modelix.fullname\" . }}-db:5432/\"\n- - name: KEYCLOAK_IMPORT\n- value: /import/realm.json\n#- name: KC_HOSTNAME_ADMIN\n# value: \"kcadmin.{{ .Values.external.hostname }}\"\n#- name: KC_HOSTNAME\n@@ -73,7 +71,7 @@ spec:\nport: 8080\nvolumeMounts:\n- name: keycloak-volume\n- mountPath: /import\n+ mountPath: /opt/keycloak/data/import\nvolumes:\n- name: keycloak-volume\nconfigMap:\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | keycloak realm import (4) |
426,496 | 04.07.2022 13:28:53 | -7,200 | 0c2bc3ce1d32ef938243383af437a4f109e50cda | allow disabling workspaces | [
{
"change_type": "MODIFY",
"old_path": "helm/dev.yaml",
"new_path": "helm/dev.yaml",
"diff": "@@ -14,3 +14,5 @@ keycloak:\nclientSecret: \"fzEj6AmIPwtKDs9D0KmWnk9CPyoLj5OS\"\nloglevel: \"debug\"\ndebug: true\n+workspaces:\n+ enabled: false\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "helm/modelix/templates/common/instances-manager-deployment.yaml",
"new_path": "helm/modelix/templates/common/instances-manager-deployment.yaml",
"diff": "+{{- if .Values.workspaces.enabled -}}\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n@@ -46,3 +47,4 @@ spec:\nmemory: \"500Mi\"\ncpu: \"1.0\"\nrestartPolicy: Always\n+{{- end -}}\n"
},
{
"change_type": "MODIFY",
"old_path": "helm/modelix/templates/common/instances-manager-service.yaml",
"new_path": "helm/modelix/templates/common/instances-manager-service.yaml",
"diff": "+{{- if .Values.workspaces.enabled -}}\napiVersion: v1\nkind: Service\nmetadata:\n@@ -20,3 +21,4 @@ spec:\nselector:\ncomponent: instances-manager\n{{- include \"modelix.selectorLabels\" . | nindent 4 }}\n+{{- end -}}\n"
},
{
"change_type": "MODIFY",
"old_path": "helm/modelix/templates/common/workspace-client-deployment.yaml",
"new_path": "helm/modelix/templates/common/workspace-client-deployment.yaml",
"diff": "+{{- if .Values.workspaces.enabled -}}\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n@@ -58,3 +59,4 @@ spec:\nperiodSeconds: 20\ntimeoutSeconds: 10\nrestartPolicy: Always\n+{{- end -}}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "helm/modelix/templates/common/workspace-client-service.yaml",
"new_path": "helm/modelix/templates/common/workspace-client-service.yaml",
"diff": "+{{- if .Values.workspaces.enabled -}}\napiVersion: v1\nkind: Service\nmetadata:\n@@ -20,3 +21,4 @@ spec:\nselector:\ncomponent: workspace-client\n{{- include \"modelix.selectorLabels\" . | nindent 4 }}\n+{{- end -}}\n"
},
{
"change_type": "MODIFY",
"old_path": "helm/modelix/templates/common/workspace-manager-deployment.yaml",
"new_path": "helm/modelix/templates/common/workspace-manager-deployment.yaml",
"diff": "+{{- if .Values.workspaces.enabled -}}\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n@@ -71,3 +72,4 @@ spec:\n- name: workspacesecret\nsecret:\nsecretName: workspacesecret\n+{{- end -}}\n"
},
{
"change_type": "MODIFY",
"old_path": "helm/modelix/templates/common/workspace-manager-service.yaml",
"new_path": "helm/modelix/templates/common/workspace-manager-service.yaml",
"diff": "+{{- if .Values.workspaces.enabled -}}\napiVersion: v1\nkind: Service\nmetadata:\n@@ -17,3 +18,4 @@ spec:\nselector:\ncomponent: workspace-manager\n{{- include \"modelix.selectorLabels\" . | nindent 4 }}\n+{{- end -}}\n"
},
{
"change_type": "MODIFY",
"old_path": "helm/modelix/templates/common/workspace-uploads-persistentvolumeclaim.yaml",
"new_path": "helm/modelix/templates/common/workspace-uploads-persistentvolumeclaim.yaml",
"diff": "+{{- if .Values.workspaces.enabled -}}\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n@@ -10,3 +11,4 @@ spec:\nresources:\nrequests:\nstorage: {{ .Values.uploadsStorageSize }}\n+{{- end -}}\n"
},
{
"change_type": "MODIFY",
"old_path": "helm/modelix/values.yaml",
"new_path": "helm/modelix/values.yaml",
"diff": "@@ -23,6 +23,9 @@ keycloak:\nloglevel: \"warn\"\ndebug: false\n+workspaces:\n+ enabled: true\n+\nexternal:\nproto: \"http\"\nhostname: \"172.16.2.52.nip.io\"\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | allow disabling workspaces |
426,496 | 04.07.2022 14:22:54 | -7,200 | b3ab7be4cbf4493dcf877e438c28cfe1ce1919a9 | some keycloak config adjustments | [
{
"change_type": "MODIFY",
"old_path": "helm/modelix/keycloak-realm.json",
"new_path": "helm/modelix/keycloak-realm.json",
"diff": "\"oauth2DeviceCodeLifespan\": 600,\n\"oauth2DevicePollingInterval\": 5,\n\"enabled\": true,\n- \"sslRequired\": \"external\",\n- \"registrationAllowed\": false,\n- \"registrationEmailAsUsername\": false,\n+ \"sslRequired\": \"none\",\n+ \"registrationAllowed\": true,\n+ \"registrationEmailAsUsername\": true,\n\"rememberMe\": false,\n\"verifyEmail\": false,\n\"loginWithEmailAllowed\": true,\n\"enabled\": true,\n\"alwaysDisplayInConsole\": false,\n\"clientAuthenticatorType\": \"client-secret\",\n- \"secret\": \"**********\",\n+ \"secret\": \"${REALM_CLIENT_SECRET}\",\n\"redirectUris\": [\n\"*\"\n],\n"
},
{
"change_type": "MODIFY",
"old_path": "helm/modelix/templates/common/keycloak-deployment.yaml",
"new_path": "helm/modelix/templates/common/keycloak-deployment.yaml",
"diff": "@@ -52,6 +52,10 @@ spec:\n# value: \"{{ .Values.external.port }}\"\n- name: KEYCLOAK_FRONTEND_URL\nvalue: \"{{ include \"modelix.externalKeycloakUrl\" . }}auth\"\n+ - name: REALM_FRONTEND_URL\n+ value: \"{{ include \"modelix.externalKeycloakUrl\" . }}\"\n+ - name: REALM_CLIENT_SECRET\n+ value: \"{{ .Values.keycloak.clientSecret }}\"\n{{ if .Values.keycloak.debug }}\n- name: DEBUG\nvalue: \"true\"\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | some keycloak config adjustments |
426,496 | 04.07.2022 15:48:29 | -7,200 | d6162c44aed8c1cf6ffd001abbf7dc875ed9c719 | helm chart testing and refinement | [
{
"change_type": "MODIFY",
"old_path": "helm/dev.yaml",
"new_path": "helm/dev.yaml",
"diff": "@@ -5,14 +5,12 @@ imageTags:\noauth: \"\"\nproxy: \"2020.3.5-202207012028-SNAPSHOT\"\nwsClient: \"\"\n- wsManager: \"\"\n-external:\n- hostname: \"172.16.2.52.nip.io\"\n- keycloak:\n- hostname: \"kc.172.16.2.52.nip.io\"\n+ wsManager: \"2020.3.5-202207041511-SNAPSHOT\"\n+ingress:\n+ hostname: \"localhost\"\nkeycloak:\nclientSecret: \"fzEj6AmIPwtKDs9D0KmWnk9CPyoLj5OS\"\n- loglevel: \"debug\"\n+ loglevel: \"warn\"\ndebug: true\nworkspaces:\n- enabled: false\n\\ No newline at end of file\n+ enabled: true\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "helm/modelix/keycloak-realm.json",
"new_path": "helm/modelix/keycloak-realm.json",
"diff": "\"oauth2DeviceCodeLifespan\": \"600\",\n\"parRequestUriLifespan\": \"60\",\n\"clientSessionMaxLifespan\": \"0\",\n- \"frontendUrl\": \"http://kc.172.16.2.52.nip.io/\"\n+ \"frontendUrl\": \"${REALM_FRONTEND_URL}\"\n},\n\"keycloakVersion\": \"18.0.1\",\n\"userManagedAccessAllowed\": true,\n"
},
{
"change_type": "MODIFY",
"old_path": "helm/modelix/templates/_helpers.tpl",
"new_path": "helm/modelix/templates/_helpers.tpl",
"diff": "@@ -62,11 +62,11 @@ Create the name of the service account to use\n{{- end }}\n{{- define \"modelix.externalUrl\" -}}\n-{{ .Values.external.proto }}://{{ .Values.external.hostname }}:{{ .Values.external.port }}/\n+{{ .Values.ingress.proto }}://{{ .Values.ingress.hostname }}:{{ .Values.ingress.port }}/\n{{- end }}\n{{- define \"modelix.externalKeycloakUrl\" -}}\n-{{ .Values.external.proto }}://{{ .Values.external.keycloak.hostname }}:{{ .Values.external.keycloak.port }}/\n+{{ .Values.ingress.proto }}://{{ .Values.ingress.hostname }}:{{ .Values.ingress.port }}/\n{{- end }}\n{{- define \"modelix.internalKeycloakUrl\" -}}\nhttp://{{ include \"modelix.fullname\" . }}-keycloak:8080/\n"
},
{
"change_type": "MODIFY",
"old_path": "helm/modelix/templates/common/ingress.yaml",
"new_path": "helm/modelix/templates/common/ingress.yaml",
"diff": "@@ -2,27 +2,26 @@ apiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\nname: \"{{ include \"modelix.fullname\" . }}-ingress\"\n+ annotations:\n+ nginx.ingress.kubernetes.io/use-regex: \"true\"\nspec:\ningressClassName: nginx\nrules:\n- - host: \"{{ .Values.external.hostname }}\"\n+ - host: \"{{ .Values.ingress.hostname }}\"\nhttp:\npaths:\n- pathType: Prefix\nbackend:\nservice:\n- name: \"{{ include \"modelix.fullname\" . }}-oauth\"\n+ name: \"{{ include \"modelix.fullname\" . }}-keycloak\"\nport:\n- number: 4180\n- path: /\n- - host: \"{{ .Values.external.keycloak.hostname }}\"\n- http:\n- paths:\n+ number: 8080\n+ path: /(resources|admin|js|realms)/.*\n- pathType: Prefix\nbackend:\nservice:\n- name: \"{{ include \"modelix.fullname\" . }}-keycloak\"\n+ name: \"{{ include \"modelix.fullname\" . }}-oauth\"\nport:\n- number: 8080\n+ number: 4180\npath: /\n"
},
{
"change_type": "MODIFY",
"old_path": "helm/modelix/templates/common/keycloak-deployment.yaml",
"new_path": "helm/modelix/templates/common/keycloak-deployment.yaml",
"diff": "@@ -41,15 +41,15 @@ spec:\n- name: KC_DB_URL\nvalue: \"jdbc:postgresql://{{ include \"modelix.fullname\" . }}-db:5432/\"\n#- name: KC_HOSTNAME_ADMIN\n- # value: \"kcadmin.{{ .Values.external.hostname }}\"\n+ # value: \"kcadmin.{{ .Values.ingress.hostname }}\"\n#- name: KC_HOSTNAME\n- # value: \"kc.{{ .Values.external.hostname }}\"\n+ # value: \"kc.{{ .Values.ingress.hostname }}\"\n#- name: KC_HOSTNAME_STRICT\n# value: \"true\"\n#- name: KC_HOSTNAME_PATH\n# value: \"/\"\n#- name: KC_HOSTNAME_PORT\n- # value: \"{{ .Values.external.port }}\"\n+ # value: \"{{ .Values.ingress.port }}\"\n- name: KEYCLOAK_FRONTEND_URL\nvalue: \"{{ include \"modelix.externalKeycloakUrl\" . }}auth\"\n- name: REALM_FRONTEND_URL\n"
},
{
"change_type": "MODIFY",
"old_path": "helm/modelix/templates/common/workspace-uploads-persistentvolumeclaim.yaml",
"new_path": "helm/modelix/templates/common/workspace-uploads-persistentvolumeclaim.yaml",
"diff": "@@ -10,5 +10,5 @@ spec:\n- ReadWriteOnce\nresources:\nrequests:\n- storage: {{ .Values.uploadsStorageSize }}\n+ storage: {{ .Values.workspaces.uploadsStorageSize }}\n{{- end -}}\n"
},
{
"change_type": "MODIFY",
"old_path": "helm/modelix/templates/local/db-data-persistentvolumeclaim.yaml",
"new_path": "helm/modelix/templates/local/db-data-persistentvolumeclaim.yaml",
"diff": "@@ -10,5 +10,5 @@ spec:\n- ReadWriteOnce\nresources:\nrequests:\n- storage: {{ .Values.modelStorageSize }}\n+ storage: {{ .Values.db.storage }}\n{{- end }}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "helm/modelix/values.yaml",
"new_path": "helm/modelix/values.yaml",
"diff": "-# Default values for modelix.\n-# This is a YAML-formatted file.\n-# Declare variables to be passed into your templates.\n+\n+nameOverride: \"\"\n+fullnameOverride: \"\"\nimageTags:\ndb: \"\"\n@@ -12,7 +12,7 @@ imageTags:\nwsManager: \"\"\nmodelStorageSize: 3000Mi\n-uploadsStorageSize: 5000Mi\n+\ndevelopmentMode: false\nkeycloak:\n@@ -25,13 +25,11 @@ keycloak:\nworkspaces:\nenabled: true\n+ uploadsStorageSize: 5000Mi\n-external:\n+ingress:\nproto: \"http\"\n- hostname: \"172.16.2.52.nip.io\"\n- port: \"80\"\n- keycloak:\n- hostname: \"kc.172.16.2.52.nip.io\"\n+ hostname: \"localhost\"\nport: \"80\"\ndb:\n@@ -39,26 +37,4 @@ db:\nuser: \"modelix\"\npassword: \"modelix\"\ndb: \"modelix\"\n-\n-\n-replicaCount: 1\n-\n-imagePullSecrets: []\n-nameOverride: \"\"\n-fullnameOverride: \"\"\n-\n-ingress:\n- enabled: false\n- className: \"\"\n- annotations: {}\n- # kubernetes.io/ingress.class: nginx\n- # kubernetes.io/tls-acme: \"true\"\n- hosts:\n- - host: chart-example.local\n- paths:\n- - path: /\n- pathType: ImplementationSpecific\n- tls: []\n- # - secretName: chart-example-tls\n- # hosts:\n- # - chart-example.local\n+ storage: 3000Mi\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | helm chart testing and refinement |
426,496 | 04.07.2022 18:37:20 | -7,200 | 59f3d98ca13643cbc0622206270e6a87780ee30b | fixed permission checking with keycloak | [
{
"change_type": "MODIFY",
"old_path": "authorization/src/main/kotlin/org/modelix/authorization/KeycloakUtils.kt",
"new_path": "authorization/src/main/kotlin/org/modelix/authorization/KeycloakUtils.kt",
"diff": "@@ -29,19 +29,48 @@ object KeycloakUtils {\nval CLIENT_ID = System.getenv(\"KEYCLOAK_CLIENT_ID\")\nval CLIENT_SECRET = System.getenv(\"KEYCLOAK_CLIENT_SECRET\")\n- val authzClient = AuthzClient.create(Configuration(\n+ val authzClient = patchUrls(AuthzClient.create(Configuration(\nBASE_URL,\nREALM,\nCLIENT_ID,\nmapOf(\"secret\" to CLIENT_SECRET),\nnull\n- ))\n+ )))\nprivate val cache = CacheBuilder.newBuilder()\n.expireAfterWrite(1, TimeUnit.MINUTES)\n.build<String, List<Permission>>()\nprivate val existingResources = HashSet<String>()\n+ private fun patchUrls(c: AuthzClient): AuthzClient {\n+ patchObject(c.serverConfiguration)\n+ patchObject(c.configuration)\n+ return c\n+ }\n+\n+ private fun patchObject(obj: Any) {\n+ obj.javaClass.superclass\n+ var cls: Class<Any>? = obj.javaClass\n+ while (cls != null) {\n+ for (field in cls.declaredFields) {\n+ field.trySetAccessible()\n+ val value = field.get(obj)\n+ if (value is String && value.contains(\"://\")) {\n+ field.set(obj, patchUrl(value))\n+ }\n+ }\n+ cls = cls.superclass\n+ }\n+ }\n+\n+ private fun patchUrl(url: String): String {\n+ return if (url.contains(\"/realms/\")) {\n+ BASE_URL + \"realms/\" + url.substringAfter(\"/realms/\")\n+ } else {\n+ url\n+ }\n+ }\n+\n@Synchronized\nfun getPermissions(accessToken: DecodedJWT): List<Permission> {\nreturn cache.get(accessToken.token) { queryPermissions(accessToken) }\n"
},
{
"change_type": "MODIFY",
"old_path": "authorization/src/main/kotlin/org/modelix/authorization/KtorAuthUtils.kt",
"new_path": "authorization/src/main/kotlin/org/modelix/authorization/KtorAuthUtils.kt",
"diff": "@@ -242,7 +242,7 @@ val serviceAccountTokenProvider: ()->String = {\n}\nfun getClientSecret(): String {\n- val varName = \"CLIENT_SECRET\"\n+ val varName = \"KEYCLOAK_CLIENT_SECRET\"\nval clientSecret = listOfNotNull(System.getProperty(varName), System.getenv(varName)).firstOrNull()\n?: throw Exception(\"Variable $varName is not specified\")\nreturn clientSecret\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "helm/modelix/templates/NOTES.txt",
"diff": "+Modelix is now available at {{ include \"modelix.externalUrl\" . }}\n"
},
{
"change_type": "MODIFY",
"old_path": "helm/modelix/templates/_helpers.tpl",
"new_path": "helm/modelix/templates/_helpers.tpl",
"diff": "@@ -62,11 +62,11 @@ Create the name of the service account to use\n{{- end }}\n{{- define \"modelix.externalUrl\" -}}\n-{{ .Values.ingress.proto }}://{{ .Values.ingress.hostname }}:{{ .Values.ingress.port }}/\n+{{ .Values.ingress.proto }}://{{ .Values.ingress.hostname }}{{ if .Values.ingress.port }}:{{ .Values.ingress.port }}{{ end }}/\n{{- end }}\n{{- define \"modelix.externalKeycloakUrl\" -}}\n-{{ .Values.ingress.proto }}://{{ .Values.ingress.hostname }}:{{ .Values.ingress.port }}/\n+{{ include \"modelix.externalUrl\" . }}\n{{- end }}\n{{- define \"modelix.internalKeycloakUrl\" -}}\nhttp://{{ include \"modelix.fullname\" . }}-keycloak:8080/\n"
},
{
"change_type": "MODIFY",
"old_path": "helm/modelix/templates/common/instances-manager-deployment.yaml",
"new_path": "helm/modelix/templates/common/instances-manager-deployment.yaml",
"diff": "@@ -32,10 +32,9 @@ spec:\nenv:\n- name: model_server_url\nvalue: http://model:28101/\n- - name: CLIENT_SECRET\n- value: \"{{ .Values.keycloak.clientSecret }}\"\n- name: WORKSPACE_CLIENT_DEPLOYMENT_NAME\nvalue: \"{{ include \"modelix.fullname\" . }}-workspace-client\"\n+ {{- include \"modelix.keycloakEnv\" . | nindent 10 }}\nports:\n- containerPort: 33332\n- containerPort: 5005\n"
},
{
"change_type": "MODIFY",
"old_path": "helm/modelix/templates/common/keycloak-deployment.yaml",
"new_path": "helm/modelix/templates/common/keycloak-deployment.yaml",
"diff": "@@ -54,6 +54,10 @@ spec:\nvalue: \"{{ include \"modelix.externalKeycloakUrl\" . }}auth\"\n- name: REALM_FRONTEND_URL\nvalue: \"{{ include \"modelix.externalKeycloakUrl\" . }}\"\n+ - name: REALM_BACKEND_URL\n+ value: \"{{ include \"modelix.internalKeycloakUrl\" . }}\"\n+ - name: KC_HOSTNAME_STRICT\n+ value: \"false\"\n- name: REALM_CLIENT_SECRET\nvalue: \"{{ .Values.keycloak.clientSecret }}\"\n{{ if .Values.keycloak.debug }}\n"
},
{
"change_type": "MODIFY",
"old_path": "helm/modelix/templates/common/workspace-manager-deployment.yaml",
"new_path": "helm/modelix/templates/common/workspace-manager-deployment.yaml",
"diff": "@@ -27,9 +27,8 @@ spec:\ncontainers:\n- env:\n- name: model_server_url\n- value: http://model:28101/\n- - name: CLIENT_SECRET\n- value: \"{{ .Values.keycloak.clientSecret }}\"\n+ value: http://{{ include \"modelix.fullname\" . }}-model:28101/\n+ {{- include \"modelix.keycloakEnv\" . | nindent 10 }}\nimage: \"modelix/modelix-workspace-manager:{{ .Values.imageTags.wsManager | default .Chart.AppVersion }}\"\nimagePullPolicy: IfNotPresent\nname: workspace-manager\n"
},
{
"change_type": "MODIFY",
"old_path": "helm/modelix/values.yaml",
"new_path": "helm/modelix/values.yaml",
"diff": "@@ -30,7 +30,7 @@ workspaces:\ningress:\nproto: \"http\"\nhostname: \"localhost\"\n- port: \"80\"\n+ port: \"\"\ndb:\nuseGCloud: false\n"
},
{
"change_type": "MODIFY",
"old_path": "model-client/src/jvmMain/kotlin/org/modelix/model/client/RestWebModelClient.kt",
"new_path": "model-client/src/jvmMain/kotlin/org/modelix/model/client/RestWebModelClient.kt",
"diff": "@@ -116,16 +116,16 @@ class RestWebModelClient @JvmOverloads constructor(\nval targetUri = baseUrl + \"counter/clientId\"\ntry {\nval response = client.target(targetUri).request().post(Entity.text(\"\"))\n+ val body = response.readEntity(String::class.java)\nif (response.unsuccessful) {\nif (response.forbidden) {\nreceivedForbiddenResponse()\n}\n- throw RuntimeException(\"Unable to get the clientId by querying $targetUri\")\n+ throw RuntimeException(\"Unable to get the clientId by querying $targetUri: ${response.statusInfo}\\n$body\")\n} else {\nreceivedSuccessfulResponse()\n}\n- val idStr = response.readEntity(String::class.java)\n- field = idStr.toInt()\n+ field = body.toInt()\n} catch (e: ProcessingException) {\nthrow RuntimeException(\"Unable to get the clientId by querying $targetUri\", e)\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "workspaces/src/main/kotlin/org/modelix/workspaces/WorkspacePersistence.kt",
"new_path": "workspaces/src/main/kotlin/org/modelix/workspaces/WorkspacePersistence.kt",
"diff": "@@ -116,6 +116,6 @@ class WorkspacePersistence() {\nreturn listOf(\"model.server.url\", \"model_server_url\")\n.flatMap { listOf(System.getProperty(it), System.getenv(it)) }\n.filterNotNull()\n- .firstOrNull() ?: \"http://localhost:31963/model/\"\n+ .firstOrNull() ?: \"http://localhost:28101/\"\n}\n}\n\\ No newline at end of file\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | fixed permission checking with keycloak |
426,496 | 05.07.2022 09:03:48 | -7,200 | 7ebab12f55a81bf8b927a5006864e1cc5328e91c | enabled permission checks on the model server | [
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/kotlin/org/modelix/model/server/KtorModelServer.kt",
"new_path": "model-server/src/main/kotlin/org/modelix/model/server/KtorModelServer.kt",
"diff": "package org.modelix.model.server\n-import io.ktor.server.application.*\n-import io.ktor.server.plugins.cors.routing.*\nimport io.ktor.http.*\n-import io.ktor.server.auth.*\n+import io.ktor.server.application.*\nimport io.ktor.server.plugins.*\n-import io.ktor.server.plugins.forwardedheaders.*\n+import io.ktor.server.plugins.cors.routing.*\nimport io.ktor.server.request.*\nimport io.ktor.server.response.*\nimport io.ktor.server.routing.*\nimport io.ktor.util.pipeline.*\n-import kotlinx.coroutines.CoroutineScope\n-import kotlinx.coroutines.delay\n-import kotlinx.coroutines.launch\nimport org.json.JSONArray\nimport org.json.JSONObject\n-import org.modelix.authorization.*\n-import org.modelix.authorization.installAuthentication\n+import org.modelix.authorization.EPermissionType\n+import org.modelix.authorization.NoPermissionException\n+import org.modelix.authorization.checkPermission\nimport org.modelix.authorization.requiresPermission\n-import org.modelix.model.IKeyListener\nimport org.modelix.model.persistent.HashUtil\nimport org.slf4j.LoggerFactory\nimport java.io.IOException\n@@ -59,7 +54,6 @@ class KtorModelServer(val storeClient: IStoreClient) {\nval HEALTH_KEY = PROTECTED_PREFIX + \"health2\"\nprivate const val LEGACY_SERVER_ID_KEY = \"repositoryId\"\nprivate const val SERVER_ID_KEY = \"server-id\"\n- private const val TEXT_PLAIN = \"text/plain\"\nprivate fun parseXForwardedFor(value: String?): List<InetAddress> {\nval result: List<InetAddress> = ArrayList()\nreturn if (value != null) {\n@@ -345,7 +339,7 @@ class KtorModelServer(val storeClient: IStoreClient) {\nreturn isTrustedAddress(call.request.origin.remoteHost)\n}\n- private suspend fun PipelineContext<Unit, ApplicationCall>.respondValue(key: String, value: String?) {\n+ private suspend fun CallContext.respondValue(key: String, value: String?) {\nif (value == null) {\ncall.respondText(\"key '$key' not found\", status = HttpStatusCode.NotFound)\n} else {\n@@ -367,7 +361,7 @@ class KtorModelServer(val storeClient: IStoreClient) {\n// A permission check has happened somewhere earlier.\nreturn\n}\n- //ModelixAuthorization.checkPermission(getUser(), PermissionId(\"model-server-entry/$key\"), type, publicIfNew = true)\n+ call.checkPermission(\"model-server-entry/$key\", type.name)\n}\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | enabled permission checks on the model server |
426,496 | 05.07.2022 18:16:27 | -7,200 | 6e7cebcee3a0e6932f9ca423081ccf7cd9331efd | Model client authentication using keycloak (2) | [
{
"change_type": "MODIFY",
"old_path": "build.gradle",
"new_path": "build.gradle",
"diff": "@@ -14,7 +14,7 @@ def getGithubCredentials() {\n}\nbuildscript {\n- ext.kotlinVersion = '1.4.32'\n+ ext.kotlinVersion = '1.6.21'\nrepositories {\n/* It is useful to have the central maven repo before the Itemis's one\n"
},
{
"change_type": "MODIFY",
"old_path": "model-client/build.gradle",
"new_path": "model-client/build.gradle",
"diff": "@@ -45,9 +45,10 @@ kotlin {\nsourceSets {\ncommonMain {\ndependencies {\n- api group: 'org.modelix', name: 'model-api', version: \"$mpsExtensionsVersion\"\n- implementation kotlin('stdlib-common:1.4.31')\n+ api group: 'org.modelix', name: 'model-api', version: \"1.0-SNAPSHOT\"\n+ implementation kotlin('stdlib-common:1.6.21')\nimplementation(\"org.jetbrains.kotlinx:kotlinx-collections-immutable:0.3.4\")\n+ implementation(\"org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0\")\n}\n}\ncommonTest {\n@@ -58,7 +59,7 @@ kotlin {\n}\njvmMain {\ndependencies {\n- implementation kotlin('stdlib-jdk8:1.4.31')\n+ implementation kotlin('stdlib-jdk8:1.6.21')\nimplementation group: 'io.vavr', name: 'vavr', version: '0.10.3'\nimplementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.11'\n@@ -83,6 +84,7 @@ kotlin {\nimplementation(\"io.ktor:ktor-client-auth:$ktor_version\")\nimplementation(\"io.ktor:ktor-client-content-negotiation:$ktor_version\")\nimplementation(\"io.ktor:ktor-serialization-kotlinx-json:$ktor_version\")\n+\n}\n}\njvmTest {\n"
},
{
"change_type": "MODIFY",
"old_path": "model-client/src/jvmMain/kotlin/org/modelix/model/client/RestWebModelClient.kt",
"new_path": "model-client/src/jvmMain/kotlin/org/modelix/model/client/RestWebModelClient.kt",
"diff": "@@ -23,7 +23,7 @@ import io.ktor.client.plugins.auth.providers.*\nimport io.ktor.client.request.*\nimport io.ktor.client.statement.*\nimport io.ktor.http.*\n-import kotlinx.coroutines.runBlocking\n+import kotlinx.coroutines.*\nimport org.apache.commons.io.FileUtils\nimport org.apache.log4j.Level\nimport org.apache.log4j.LogManager\n@@ -48,6 +48,8 @@ import java.util.concurrent.ExecutorService\nimport java.util.concurrent.Executors\nimport java.util.concurrent.Future\nimport java.util.concurrent.atomic.AtomicInteger\n+import kotlin.time.Duration\n+import kotlin.time.Duration.Companion.seconds\nval HttpResponse.successful: Boolean\nget() = this.status.value in 200..299\n@@ -136,8 +138,7 @@ class RestWebModelClient @JvmOverloads constructor(\nreturn field\n}\nprivate set\n- private val requestExecutor: ExecutorService = Executors.newFixedThreadPool(10)\n- private val pollingExecutor: ExecutorService = Executors.newCachedThreadPool()\n+ private val coroutineScope = CoroutineScope(Dispatchers.Default)\nprivate val client = HttpClient(CIO) {\nthis.followRedirects = false\ninstall(HttpTimeout) {\n@@ -189,8 +190,7 @@ class RestWebModelClient @JvmOverloads constructor(\nlisteners.forEach { it.dispose() }\nlisteners.clear()\n}\n- requestExecutor.shutdown()\n- pollingExecutor.shutdown()\n+ coroutineScope.cancel(\"model client disposed\")\n}\noverride fun getPendingSize(): Int = pendingWrites.get()\n@@ -443,32 +443,29 @@ class RestWebModelClient @JvmOverloads constructor(\ninner class PollingListener(val key: String, val keyListener: IKeyListener) {\nprivate var lastValue: String? = null\n- private var future: Future<*>? = null\n+ private var job: Job? = null\nfun dispose() {\n- future?.cancel(true)\n+ job?.cancel(\"listener disposed\")\n}\nfun start() {\n- future = pollingExecutor.submit {\n- while (future?.isCancelled != true) {\n+ job = coroutineScope.launch {\n+ while (job?.isActive == true) {\ntry {\nrun()\n- } catch (e: InterruptedException) {\n- return@submit\n} catch (e: Exception) {\nLOG.error(\"Polling for '$key' failed\", e)\n- sleep(5000)\n+ delay(5.seconds)\n}\n}\n}\n}\n- private fun run() {\n+ private suspend fun run() {\nvar url = baseUrl + \"poll/\" + URLEncoder.encode(key, StandardCharsets.UTF_8)\nif (lastValue != null) {\nurl += \"?lastKnownValue=\" + URLEncoder.encode(lastValue, StandardCharsets.UTF_8)\n}\nval value: String\n- runBlocking {\nval response = client.get(url)\nif (response.unsuccessful) {\nif (response.forbidden) {\n@@ -477,7 +474,6 @@ class RestWebModelClient @JvmOverloads constructor(\nthrow RuntimeException(\"Request for key '\" + key + \"' failed: \" + response.status)\n}\nvalue = response.bodyAsText()\n- }\nif (value != lastValue) {\nlastValue = value\n"
},
{
"change_type": "MODIFY",
"old_path": "model-client/src/jvmMain/kotlin/org/modelix/model/client/VersionChangeDetector.kt",
"new_path": "model-client/src/jvmMain/kotlin/org/modelix/model/client/VersionChangeDetector.kt",
"diff": "package org.modelix.model.client\n+import kotlinx.coroutines.*\nimport org.apache.log4j.Level\nimport org.apache.log4j.LogManager\nimport org.modelix.model.IKeyListener\nimport org.modelix.model.IKeyValueStore\n-import org.modelix.model.client.SharedExecutors.fixDelay\n-import java.util.concurrent.ScheduledFuture\nabstract class VersionChangeDetector(private val store: IKeyValueStore, private val key: String) {\nprivate val keyListener: IKeyListener\nvar lastVersionHash: String? = null\nprivate set\n- private val pollingTask: ScheduledFuture<*>\n+ private var job: Job? = null\n+ private val coroutineScope = CoroutineScope(Dispatchers.Default)\n@Synchronized\nprivate fun versionChanged(newVersion: String?) {\n@@ -45,7 +45,8 @@ abstract class VersionChangeDetector(private val store: IKeyValueStore, private\nprotected abstract fun processVersionChange(oldVersion: String?, newVersion: String?)\nfun dispose() {\n- pollingTask.cancel(false)\n+ job?.cancel(\"disposed\")\n+ coroutineScope.cancel(\"disposed\")\nstore.removeListener(key, keyListener)\n}\n@@ -62,21 +63,19 @@ abstract class VersionChangeDetector(private val store: IKeyValueStore, private\nversionChanged(versionHash)\n}\n}\n+\nSharedExecutors.FIXED.execute { store.listen(key, keyListener) }\n- pollingTask = fixDelay(\n- 3000,\n- object : Runnable {\n- override fun run() {\n+ job = coroutineScope.launch {\n+ while (isActive) {\nval version = store[key]\n- if (version == lastVersionHash) {\n- return\n- }\n+ if (version != lastVersionHash) {\nif (LOG.isDebugEnabled) {\nLOG.debug(\"New version detected by polling: $version\")\n}\nversionChanged(version)\n}\n+ delay(3000)\n+ }\n}\n- )\n}\n}\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Model client authentication using keycloak (2) |
426,496 | 06.07.2022 09:22:31 | -7,200 | 1b92ec8018dfa61c1042562bf66395118cb8ac64 | Old itemis nexus disabled
It has some issues currently and should be replaced
anyway. | [
{
"change_type": "MODIFY",
"old_path": "build.gradle",
"new_path": "build.gradle",
"diff": "@@ -24,7 +24,7 @@ buildscript {\nmaven { url 'https://plugins.gradle.org/m2/' }\nmavenCentral()\nmaven { url 'https://artifacts.itemis.cloud/repository/maven-mps/' }\n- maven { url 'https://projects.itemis.de/nexus/content/repositories/mbeddr' }\n+ //maven { url 'https://projects.itemis.de/nexus/content/repositories/mbeddr' }\n}\ndependencies {\n@@ -102,7 +102,6 @@ subprojects {\nmaven { url \"https://repo.maven.apache.org/maven2\" }\nmavenCentral()\nmaven { url 'https://artifacts.itemis.cloud/repository/maven-mps/' }\n- maven { url 'https://projects.itemis.de/nexus/content/repositories/mbeddr' }\n}\npublishing {\n@@ -133,18 +132,18 @@ subprojects {\n}\n}\n}\n- if (project.hasProperty(\"projects.itemis.de.user\")) {\n- maven {\n- name = \"itemisNexus2\"\n- url = modelixVersion.contains(\"SNAPSHOT\")\n- ? uri(\"https://projects.itemis.de/nexus/content/repositories/mbeddr_snapshots/\")\n- : uri(\"https://projects.itemis.de/nexus/content/repositories/mbeddr/\")\n- credentials {\n- username = project.findProperty(\"projects.itemis.de.user\").toString()\n- password = project.findProperty(\"projects.itemis.de.pw\").toString()\n- }\n- }\n- }\n+// if (project.hasProperty(\"projects.itemis.de.user\")) {\n+// maven {\n+// name = \"itemisNexus2\"\n+// url = modelixVersion.contains(\"SNAPSHOT\")\n+// ? uri(\"https://projects.itemis.de/nexus/content/repositories/mbeddr_snapshots/\")\n+// : uri(\"https://projects.itemis.de/nexus/content/repositories/mbeddr/\")\n+// credentials {\n+// username = project.findProperty(\"projects.itemis.de.user\").toString()\n+// password = project.findProperty(\"projects.itemis.de.pw\").toString()\n+// }\n+// }\n+// }\n}\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "gradle-plugin/build.gradle",
"new_path": "gradle-plugin/build.gradle",
"diff": "@@ -11,7 +11,8 @@ compileJava {\nrepositories {\nmavenCentral()\n- maven { url 'https://projects.itemis.de/nexus/content/repositories/mbeddr' }\n+ maven { url 'https://artifacts.itemis.cloud/repository/maven-mps/' }\n+ //maven { url 'https://projects.itemis.de/nexus/content/repositories/mbeddr' }\n//maven { url = uri(\"https://modelix.jfrog.io/artifactory/itemis/\") } // caching proxy for the itemis repo\n}\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Old itemis nexus disabled
It has some issues currently and should be replaced
anyway. |
426,496 | 06.07.2022 09:34:42 | -7,200 | 86b3ed47dcfa2c128b570b899f8c9cb4df9bba56 | The gradle plugin is not yet available at the new nexus | [
{
"change_type": "MODIFY",
"old_path": "build.gradle",
"new_path": "build.gradle",
"diff": "@@ -24,7 +24,7 @@ buildscript {\nmaven { url 'https://plugins.gradle.org/m2/' }\nmavenCentral()\nmaven { url 'https://artifacts.itemis.cloud/repository/maven-mps/' }\n- //maven { url 'https://projects.itemis.de/nexus/content/repositories/mbeddr' }\n+ maven { url 'https://projects.itemis.de/nexus/content/repositories/mbeddr' }\n}\ndependencies {\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | The gradle plugin is not yet available at the new nexus |
426,496 | 08.07.2022 09:40:51 | -7,200 | aa1ac7edc45dc03df208d422b9d81db91c146d06 | Cleanup nginx config | [
{
"change_type": "MODIFY",
"old_path": "proxy/nginx.conf",
"new_path": "proxy/nginx.conf",
"diff": "@@ -11,11 +11,7 @@ http {\nresolver $NAMESERVER valid=10s;\nlocation ~ ^/model/(.*)$ {\n- proxy_set_header Referer $http_referer;\n- proxy_set_header X-Real-IP $remote_addr;\nproxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n- proxy_set_header X-Forwarded-Proto $scheme;\n- proxy_set_header X-Forwarded-Url $scheme://$http_host/model/$1;\nproxy_set_header Host $http_host;\nproxy_set_header X-Forwarded-Host $http_host;\n@@ -30,10 +26,7 @@ http {\n}\nlocation ~ ^/keycloak/(.*)$ {\n- proxy_set_header Referer $http_referer;\n- proxy_set_header X-Real-IP $remote_addr;\nproxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n- proxy_set_header X-Forwarded-Proto $scheme;\nproxy_set_header Host $http_host;\nproxy_set_header X-Forwarded-Host $http_host;\n@@ -45,10 +38,7 @@ http {\n# keycloak doesn't work behind a subpath. That is probably a bug in keycloak and this is the workaround.\nlocation ~ ^/((resources|admin|js|realms)/.*)$ {\n- proxy_set_header Referer $http_referer;\n- proxy_set_header X-Real-IP $remote_addr;\nproxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n- proxy_set_header X-Forwarded-Proto $scheme;\nproxy_set_header Host $http_host;\nproxy_set_header X-Forwarded-Host $http_host;\n@@ -90,11 +80,7 @@ http {\n# }\nlocation ~ ^/workspace-manager/(.*)$ {\n- proxy_set_header Referer $http_referer;\n- proxy_set_header X-Real-IP $remote_addr;\nproxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n- proxy_set_header X-Forwarded-Proto $scheme;\n- proxy_set_header X-Forwarded-Url $scheme://$http_host/workspace-manager/$1;\nproxy_set_header Host $http_host;\nproxy_set_header X-Forwarded-Host $http_host;\n@@ -105,11 +91,7 @@ http {\n}\nlocation ~ ^/instances-manager/(.*)$ {\n- proxy_set_header Referer $http_referer;\n- proxy_set_header X-Real-IP $remote_addr;\nproxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n- proxy_set_header X-Forwarded-Proto $scheme;\n- proxy_set_header X-Forwarded-Url $scheme://$http_host/instances-manager/$1;\nproxy_set_header Host $http_host;\nproxy_set_header X-Forwarded-Host $http_host;\n@@ -120,11 +102,7 @@ http {\n}\nlocation ~ ^/([a-zA-Z0-9-_*]+/.*)$ {\n- proxy_set_header Referer $http_referer;\n- proxy_set_header X-Real-IP $remote_addr;\nproxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n- proxy_set_header X-Forwarded-Proto $scheme;\n- proxy_set_header X-Forwarded-Url $scheme://$http_host/$1;\nproxy_set_header Host $http_host;\nproxy_set_header X-Forwarded-Host $http_host;\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | Cleanup nginx config |
426,496 | 08.07.2022 19:07:50 | -7,200 | 7e29d94c6eb2f77a66ddbc1862ec48243edc1372 | fixed ModelClient_Test | [
{
"change_type": "MODIFY",
"old_path": "authorization/src/main/kotlin/org/modelix/authorization/KeycloakUtils.kt",
"new_path": "authorization/src/main/kotlin/org/modelix/authorization/KeycloakUtils.kt",
"diff": "*/\npackage org.modelix.authorization\n+import com.auth0.jwk.JwkProviderBuilder\nimport com.auth0.jwt.interfaces.DecodedJWT\nimport com.google.common.cache.CacheBuilder\nimport org.keycloak.authorization.client.AuthzClient\n@@ -21,6 +22,7 @@ import org.keycloak.representations.idm.authorization.AuthorizationRequest\nimport org.keycloak.representations.idm.authorization.Permission\nimport org.keycloak.representations.idm.authorization.PermissionRequest\nimport org.keycloak.representations.idm.authorization.ResourceRepresentation\n+import java.net.URL\nimport java.util.concurrent.TimeUnit\nobject KeycloakUtils {\n@@ -37,6 +39,8 @@ object KeycloakUtils {\nnull\n)))\n+ val jwkProvider = JwkProviderBuilder(URL(\"${BASE_URL}realms/$REALM/protocol/openid-connect/certs\")).build()\n+\nprivate val cache = CacheBuilder.newBuilder()\n.expireAfterWrite(1, TimeUnit.MINUTES)\n.build<String, List<Permission>>()\n"
},
{
"change_type": "MODIFY",
"old_path": "authorization/src/main/kotlin/org/modelix/authorization/KtorAuthUtils.kt",
"new_path": "authorization/src/main/kotlin/org/modelix/authorization/KtorAuthUtils.kt",
"diff": "@@ -43,7 +43,6 @@ import java.security.interfaces.RSAPublicKey\nimport java.util.*\nprivate const val jwtAuth = \"jwtAuth\"\n-private val jwkProvider = JwkProviderBuilder(URL(\"${KeycloakUtils.BASE_URL}realms/${KeycloakUtils.REALM}/protocol/openid-connect/certs\")).build()\nprivate val httpClient = HttpClient(CIO)\nprivate val UNIT_TEST_MODE_KEY = AttributeKey<Boolean>(\"unit-test-mode\")\n@@ -63,7 +62,7 @@ fun Application.installAuthentication(unitTestMode: Boolean = false) {\n} else {\n// \"Authorization: Bearer ...\" header is provided in the header by OAuth proxy\njwt(jwtAuth) {\n- verifier(jwkProvider) {\n+ verifier(KeycloakUtils.jwkProvider) {\nacceptLeeway(60L)\n}\nchallenge { _, _ ->\n@@ -181,7 +180,7 @@ fun ApplicationCall.getUserName(): String? {\n}\nfun verifyTokenSignature(token: DecodedJWT) {\n- val jwk = jwkProvider.get(token.keyId)\n+ val jwk = KeycloakUtils.jwkProvider.get(token.keyId)\nval publicKey = jwk.publicKey as? RSAPublicKey ?: throw RuntimeException(\"Invalid key type\")\nval algorithm = when (jwk.algorithm) {\n\"RS256\" -> Algorithm.RSA256(publicKey, null)\n"
},
{
"change_type": "MODIFY",
"old_path": "model-client/src/commonTest/kotlin/org/modelix/model/Hamt_Test.kt",
"new_path": "model-client/src/commonTest/kotlin/org/modelix/model/Hamt_Test.kt",
"diff": "@@ -110,7 +110,7 @@ class Hamt_Test {\nval rand = Random(123456789L)\nval entries = HashMap<Long, KVEntryReference<CPNode>>()\nfor (i in 1..10) {\n- for (k in 1..1000) {\n+ for (k in 1..500) {\nval id = i * 1_000_000L + k\nentries[id] = createEntry(id)\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "model-client/src/jvmMain/kotlin/org/modelix/model/client/RestWebModelClient.kt",
"new_path": "model-client/src/jvmMain/kotlin/org/modelix/model/client/RestWebModelClient.kt",
"diff": "@@ -44,11 +44,7 @@ import java.io.File\nimport java.net.URLEncoder\nimport java.nio.charset.StandardCharsets\nimport java.util.*\n-import java.util.concurrent.ExecutorService\n-import java.util.concurrent.Executors\n-import java.util.concurrent.Future\nimport java.util.concurrent.atomic.AtomicInteger\n-import kotlin.time.Duration\nimport kotlin.time.Duration.Companion.seconds\nval HttpResponse.successful: Boolean\n@@ -142,16 +138,22 @@ class RestWebModelClient @JvmOverloads constructor(\nprivate val client = HttpClient(CIO) {\nthis.followRedirects = false\ninstall(HttpTimeout) {\n- connectTimeoutMillis = 1000\n+ connectTimeoutMillis = 1.seconds.inWholeMilliseconds\n+ requestTimeoutMillis = 30.seconds.inWholeMilliseconds\n}\ninstall(Auth) {\nbearer {\nloadTokens {\nLOG.debug(\"loadTokens\")\n- ModelixOAuthClient.getTokens()?.let { BearerTokens(it.accessToken, it.refreshToken) }\n+ getAuthToken()?.let { BearerTokens(it, \"\") }\n+ ?: ModelixOAuthClient.getTokens()?.let { BearerTokens(it.accessToken, it.refreshToken) }\n}\nrefreshTokens {\nLOG.debug(\"refreshTokens\")\n+ val providedToken = getAuthToken()\n+ if (providedToken != null && providedToken != this.oldTokens?.accessToken) {\n+ BearerTokens(providedToken, \"\")\n+ } else {\nvar url = baseUrl\nif (!url.endsWith(\"/\")) url += \"/\"\nif (url.endsWith(\"/model/\")) url = url.substringBeforeLast(\"/model/\")\n@@ -161,6 +163,18 @@ class RestWebModelClient @JvmOverloads constructor(\n}\n}\n}\n+ install(HttpRequestRetry) {\n+ retryOnExceptionOrServerErrors(maxRetries = 3)\n+ exponentialDelay()\n+ modifyRequest {\n+ try {\n+ runBlocking {\n+ response?.let { println(it.bodyAsText()) }\n+ }\n+ } catch (_: Exception) {}\n+ }\n+ }\n+ }\nprivate val listeners: MutableList<PollingListener> = ArrayList()\noverride val asyncStore: IKeyValueStore = AsyncStore(this)\nprivate val cache = PrefetchCache.contextIndirectCache(ObjectStoreCache(KeyValueStoreCache(asyncStore)))\n@@ -299,8 +313,8 @@ class RestWebModelClient @JvmOverloads constructor(\n}\n}\n- override fun listen(key: String, keyListener: IKeyListener) {\n- val pollingListener = PollingListener(key, keyListener)\n+ override fun listen(key: String, listener: IKeyListener) {\n+ val pollingListener = PollingListener(key, listener)\nsynchronized(listeners) {\nlisteners.add(pollingListener)\npollingListener.start()\n@@ -449,12 +463,14 @@ class RestWebModelClient @JvmOverloads constructor(\n}\nfun start() {\njob = coroutineScope.launch {\n- while (job?.isActive == true) {\n+ while (isActive) {\ntry {\nrun()\n+ } catch (e: CancellationException) {\n+ break\n} catch (e: Exception) {\nLOG.error(\"Polling for '$key' failed\", e)\n- delay(5.seconds)\n+ delay(1.seconds)\n}\n}\n}\n@@ -465,8 +481,15 @@ class RestWebModelClient @JvmOverloads constructor(\nurl += \"?lastKnownValue=\" + URLEncoder.encode(lastValue, StandardCharsets.UTF_8)\n}\n- val value: String\n- val response = client.get(url)\n+ val value: String?\n+ val response = client.get(url) {\n+ timeout {\n+ requestTimeoutMillis = 60.seconds.inWholeMilliseconds // long polling\n+ }\n+ }\n+ if (response.status == HttpStatusCode.NotFound) {\n+ delay(1.seconds)\n+ } else {\nif (response.unsuccessful) {\nif (response.forbidden) {\nreceivedForbiddenResponse()\n@@ -474,13 +497,13 @@ class RestWebModelClient @JvmOverloads constructor(\nthrow RuntimeException(\"Request for key '\" + key + \"' failed: \" + response.status)\n}\nvalue = response.bodyAsText()\n-\nif (value != lastValue) {\nlastValue = value\nkeyListener.changed(key, value)\n}\n}\n}\n+ }\ninit {\nif (baseUrl.isEmpty()) {\n"
},
{
"change_type": "MODIFY",
"old_path": "model-client/src/jvmMain/kotlin/org/modelix/model/oauth/ModelixOAuthClient.kt",
"new_path": "model-client/src/jvmMain/kotlin/org/modelix/model/oauth/ModelixOAuthClient.kt",
"diff": "@@ -24,7 +24,6 @@ import com.google.api.client.json.gson.GsonFactory\nimport com.google.api.client.util.store.DataStoreFactory\nimport com.google.api.client.util.store.MemoryDataStoreFactory\n-\nobject ModelixOAuthClient {\nprivate var DATA_STORE_FACTORY: DataStoreFactory = MemoryDataStoreFactory()\nprivate val SCOPE = \"email\"\n"
},
{
"change_type": "MODIFY",
"old_path": "model-client/src/jvmTest/kotlin/org/modelix/model/ModelClient_Test.kt",
"new_path": "model-client/src/jvmTest/kotlin/org/modelix/model/ModelClient_Test.kt",
"diff": "@@ -59,43 +59,47 @@ class ModelClient_Test {\n// It should be marked as a slow test and run separately from unit tests\n@Test\nfun test_t1() {\n+ val numClients = 3 * Runtime.getRuntime().availableProcessors() // tests were failing on the CI server, but not locally\n+ val numListenersPerClient = 3\n+ val numKeys = numListenersPerClient * 2\n+\nval rand = Random(67845)\nval url = \"http://localhost:28101/\"\n- val clients = listOf(RestWebModelClient(url), RestWebModelClient(url), RestWebModelClient(url))\n+ val clients = (0 until numClients).map { RestWebModelClient(url) }\nval listeners: MutableList<Listener> = ArrayList()\nval expected: MutableMap<String, String> = HashMap()\n- for (client in clients) {\n- for (i in 1..3) {\n- println(\"Phase A: client $client i=$i of 3\")\n+ for (client in clients.withIndex()) {\n+ for (i in 0 until numListenersPerClient) {\n+ println(\"Phase A: client $client i=$i of ${clients.size}\")\n// Thread.sleep(50)\nval key = \"test_$i\"\n- val l = Listener(key, client)\n- client.listen(key, l)\n+ val l = Listener(key, client.value, client.index, i)\n+ client.value.listen(key, l)\nlisteners.add(l)\n}\n}\nThread.sleep(2000)\n- for (i in 1..10) {\n- println(\"Phase B: i=$i of 10\")\n+ for (i in (1..2).flatMap { 0 until numKeys }) {\n+ println(\"Phase B: i=$i of $numKeys\")\nif (!modelServer.isUp()) {\nthrow IllegalStateException(\"The model-server is not up\")\n}\n- val key = \"test_\" + rand.nextInt(10)\n+ val key = \"test_$i\"\nval value = rand.nextLong().toString()\nexpected[key] = value\nprintln(\" put $key = $value\")\n- val client = rand.nextInt(clients.size)\n- println(\" client is $client\")\n+ val writingClientIndex = rand.nextInt(clients.size)\n+ println(\" client is $writingClientIndex\")\ntry {\n- clients[client].put(key, value)\n+ clients[writingClientIndex].put(key, value)\n} catch (e: Exception) {\nSystem.err.println(e.message)\ne.printStackTrace(System.err)\nthrow e\n}\n- println(\" put to client $client\")\n+ println(\" put to client $writingClientIndex\")\nfor (client in clients) {\n- Assert.assertEquals(expected[key], client[key])\n+ Assert.assertEquals(expected[key], client.get(key))\n}\nprintln(\" verified\")\nfor (timeout in 0..3000) {\n@@ -105,9 +109,9 @@ class ModelClient_Test {\n}\nThread.sleep(1)\n}\n- val successfulListeners = listeners.filter { expected[it.key] == it.lastValue }.count()\n- if (successfulListeners < listeners.size) {\n- fail(\"change only received on $successfulListeners of ${listeners.size} listeners\")\n+ val unsuccessfulListeners = listeners.filter { expected[it.key] != it.lastValue }\n+ if (unsuccessfulListeners.isNotEmpty()) {\n+ fail(\"change not received by listeners: $unsuccessfulListeners\")\n}\nprintln(\" verified also on listeners\")\n}\n@@ -116,11 +120,12 @@ class ModelClient_Test {\n}\n}\n- inner class Listener(var key: String, private val client: RestWebModelClient) : IKeyListener {\n+ inner class Listener(var key: String, private val client: RestWebModelClient, val clientIndex: Int, val listenerIndex: Int) : IKeyListener {\nvar lastValue: String? = null\noverride fun changed(key: String, value: String?) {\nlastValue = value\n- println(\"+change \" + client + \" / \" + this.key + \" / \" + key + \" = \" + value)\n+ println(\"+change \" + this + \" / \" + this.key + \" / \" + key + \" = \" + value)\n}\n+ override fun toString() = \"$clientIndex.$listenerIndex:$key\"\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/kotlin/org/modelix/model/server/IStoreClient.kt",
"new_path": "model-server/src/main/kotlin/org/modelix/model/server/IStoreClient.kt",
"diff": "*/\npackage org.modelix.model.server\n-import kotlinx.coroutines.CoroutineScope\n-import kotlinx.coroutines.delay\n-import kotlinx.coroutines.launch\n+import kotlinx.coroutines.*\n+import kotlinx.coroutines.channels.Channel\n+import kotlinx.coroutines.sync.Semaphore\nimport org.modelix.model.IKeyListener\n+import kotlin.time.Duration.Companion.seconds\ninterface IStoreClient {\noperator fun get(key: String): String?\n@@ -30,16 +31,21 @@ interface IStoreClient {\nfun generateId(key: String): Long\n}\n-suspend fun CoroutineScope.pollEntry(storeClient: IStoreClient, key: String, lastKnownValue: String?, handler: suspend (String?)->Unit) {\n+suspend fun pollEntry(storeClient: IStoreClient, key: String, lastKnownValue: String?, handler: suspend (String?)->Unit) {\n+ coroutineScope {\nvar handlerCalled = false\nval callHandler: suspend (String?)->Unit = {\nhandlerCalled = true\nhandler(it)\n}\n+\n+ val channel = Channel<Unit>(Channel.RENDEZVOUS)\n+\nval listener = object : IKeyListener {\noverride fun changed(key_: String, newValue: String?) {\nlaunch {\ncallHandler(newValue)\n+ channel.trySend(Unit)\n}\n}\n}\n@@ -57,15 +63,15 @@ suspend fun CoroutineScope.pollEntry(storeClient: IStoreClient, key: String, las\nval value = storeClient[key]\nif (value != lastKnownValue) {\ncallHandler(value)\n- return\n+ return@coroutineScope\n}\n}\n- for (i in 1..250) {\n- if (handlerCalled) break\n- delay(100L)\n+ withTimeoutOrNull(25.seconds) {\n+ channel.receive() // wait until the listener is called\n}\n} finally {\nstoreClient.removeListener(key, listener)\n}\nif (!handlerCalled) handler(storeClient[key])\n}\n+}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "model-server/src/main/kotlin/org/modelix/model/server/InMemoryStoreClient.kt",
"new_path": "model-server/src/main/kotlin/org/modelix/model/server/InMemoryStoreClient.kt",
"diff": "*/\npackage org.modelix.model.server\n+import ch.qos.logback.classic.Logger\nimport org.modelix.model.IKeyListener\n+import org.slf4j.LoggerFactory\nimport java.io.BufferedReader\nimport java.io.FileReader\nimport java.io.FileWriter\nimport java.io.IOException\nimport java.util.*\n-import java.util.function.Consumer\n-import java.util.function.Function\n-import java.util.stream.Collectors\nclass InMemoryStoreClient : IStoreClient {\n+ companion object {\n+ private val LOG = LoggerFactory.getLogger(InMemoryStoreClient::class.java)\n+ }\n+\nprivate val values: MutableMap<String, String?> = HashMap()\n- private val listeners: MutableMap<String?, MutableList<IKeyListener>> = HashMap()\n+ private val listeners: MutableMap<String?, MutableSet<IKeyListener>> = HashMap()\n@Synchronized\noverride fun get(key: String): String? {\nreturn values[key]\n@@ -34,19 +37,26 @@ class InMemoryStoreClient : IStoreClient {\n@Synchronized\noverride fun getAll(keys: List<String>): List<String?> {\n- return keys.stream().map { key: String -> this[key] }.collect(Collectors.toList())\n+ return keys.map { values[it] }\n}\n@Synchronized\noverride fun getAll(keys: Set<String>): Map<String, String?> {\n- return keys.stream().collect(Collectors.toMap(Function.identity(), Function { key: String -> this[key] }))\n+ return keys.associateWith { values[it] }\n}\n@Synchronized\noverride fun put(key: String, value: String?) {\nvalues[key] = value\n- listeners.getOrDefault(key, emptyList<IKeyListener>())\n- .forEach(Consumer { l: IKeyListener -> l.changed(key, value) })\n+ listeners[key]?.toList()?.forEach {\n+ try {\n+ it.changed(key, value)\n+ } catch (ex : Exception) {\n+ println(ex.message)\n+ ex.printStackTrace()\n+ LOG.error(\"Failed to notify listeners after put '$key' = '$value'\", ex)\n+ }\n+ }\n}\n@Synchronized\n@@ -58,22 +68,23 @@ class InMemoryStoreClient : IStoreClient {\n@Synchronized\noverride fun listen(key: String, listener: IKeyListener) {\n- if (!listeners.containsKey(key)) {\n- listeners[key] = LinkedList()\n- }\n- listeners[key]!!.add(listener)\n+ listeners.getOrPut(key) { LinkedHashSet() }.add(listener)\n}\n@Synchronized\noverride fun removeListener(key: String, listener: IKeyListener) {\n- if (!listeners.containsKey(key)) {\n- return\n- }\n- listeners[key]!!.remove(listener)\n+ listeners[key]?.remove(listener)\n}\n+ @Synchronized\noverride fun generateId(key: String): Long {\n- return key.hashCode().toLong()\n+ val id = try {\n+ get(key)?.toLong() ?: 0L\n+ } catch (e : NumberFormatException) {\n+ 0L\n+ } + 1L\n+ put(key, id.toString())\n+ return id\n}\n@Synchronized\n"
}
]
| Kotlin | Apache License 2.0 | modelix/modelix | fixed ModelClient_Test |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.