This is an automated email from the ASF dual-hosted git repository. peacewong pushed a commit to branch dev-1.3.0 in repository https://gitbox.apache.org/repos/asf/incubator-linkis.git
commit a8f79ad90056694f86a9e566d9f0da3c82f993af Author: Jack Xu <[email protected]> AuthorDate: Tue Aug 23 22:34:13 2022 +0800 fix: fix the HaContextGatewayRouter for ps-cs service --- linkis-dist/package/conf/linkis-ps-cs.properties | 28 ---------------- .../conf/linkis-ps-data-source-manager.properties | 37 ---------------------- .../conf/linkis-ps-metadataquery.properties | 21 ------------ linkis-dist/package/sbin/ext/linkis-ps-cs | 33 ------------------- .../package/sbin/ext/linkis-ps-data-source-manager | 35 -------------------- .../package/sbin/ext/linkis-ps-metadataquery | 33 ------------------- .../ujes/route/HaContextGatewayRouter.scala | 28 ++++++++-------- 7 files changed, 13 insertions(+), 202 deletions(-) diff --git a/linkis-dist/package/conf/linkis-ps-cs.properties b/linkis-dist/package/conf/linkis-ps-cs.properties deleted file mode 100644 index f5526de38..000000000 --- a/linkis-dist/package/conf/linkis-ps-cs.properties +++ /dev/null @@ -1,28 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# -##restful -wds.linkis.server.restful.scan.packages=org.apache.linkis.cs.server.restful -##mybatis -wds.linkis.server.mybatis.mapperLocations=classpath*:org/apache/linkis/cs/persistence/dao/impl/*.xml -wds.linkis.server.mybatis.typeAliasesPackage=org.apache.linkis.cs.persistence.entity -wds.linkis.server.mybatis.BasePackage=org.apache.linkis.cs.persistence.dao -##Spring -spring.server.port=9108 -# ps-cs prefix must be started with 'cs_' -spring.eureka.instance.metadata-map.route=cs_1_dev -wds.linkis.cs.deserialize.replace_package_header.enable=false - diff --git a/linkis-dist/package/conf/linkis-ps-data-source-manager.properties b/linkis-dist/package/conf/linkis-ps-data-source-manager.properties deleted file mode 100644 index b4f0d634b..000000000 --- a/linkis-dist/package/conf/linkis-ps-data-source-manager.properties +++ /dev/null @@ -1,37 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -##restful -wds.linkis.server.restful.scan.packages=org.apache.linkis.datasourcemanager.core.restful - -##mybatis -wds.linkis.server.mybatis.mapperLocations=classpath:org/apache/linkis/datasourcemanager/core/dao/mapper/*.xml - -wds.linkis.server.mybatis.typeAliasesPackage=org.apache.linkis.datasourcemanager.common.domain,org.apache.linkis.datasourcemanager.core.vo - -wds.linkis.server.mybatis.BasePackage=org.apache.linkis.datasourcemanager.core.dao - - -##hive meta -hive.meta.url= -hive.meta.user= -hive.meta.password= -wds.linkis.metadata.hive.encode.enabled=false - -##Spring -spring.server.port=9109 -spring.spring.main.allow-bean-definition-overriding=true -spring.spring.jackson.serialization.FAIL_ON_EMPTY_BEANS=false -spring.jackson.serialization.FAIL_ON_EMPTY_BEANS=false diff --git a/linkis-dist/package/conf/linkis-ps-metadataquery.properties b/linkis-dist/package/conf/linkis-ps-metadataquery.properties deleted file mode 100644 index 02450d77b..000000000 --- a/linkis-dist/package/conf/linkis-ps-metadataquery.properties +++ /dev/null @@ -1,21 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -wds.linkis.server.mdm.service.instance.expire-in-seconds=1800 -wds.linkis.server.restful.scan.packages=org.apache.linkis.metadata.query.server.restful - -wds.linkis.server.dsm.app.name=linkis-ps-data-source-manager -##Spring -spring.server.port=9110 diff --git a/linkis-dist/package/sbin/ext/linkis-ps-cs b/linkis-dist/package/sbin/ext/linkis-ps-cs deleted file mode 100644 index fecc83c21..000000000 --- a/linkis-dist/package/sbin/ext/linkis-ps-cs +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# description: cs start cmd -# -# Modified for Linkis 1.0.0 - - -export SERVER_SUFFIX="linkis-public-enhancements/linkis-ps-cs" - -#export DEBUG_PORT= - -export SERVER_CLASS=org.apache.linkis.cs.server.LinkisCSApplication - -export COMMON_START_BIN=$LINKIS_HOME/sbin/ext/linkis-common-start -if [[ ! -f "${COMMON_START_BIN}" ]]; then - echo "The $COMMON_START_BIN does not exist!" - exit 1 -else - sh $COMMON_START_BIN -fi \ No newline at end of file diff --git a/linkis-dist/package/sbin/ext/linkis-ps-data-source-manager b/linkis-dist/package/sbin/ext/linkis-ps-data-source-manager deleted file mode 100644 index 200305b49..000000000 --- a/linkis-dist/package/sbin/ext/linkis-ps-data-source-manager +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# description: data-source-manager start cmd -# -# Modified for Linkis 1.1.0 -# - - -export SERVER_SUFFIX="linkis-public-enhancements/linkis-ps-data-source-manager" - - -#export DEBUG_PORT= - -export SERVER_CLASS=org.apache.linkis.datasourcemanager.core.LinkisDataSourceManagerApplication - -export COMMON_START_BIN=$LINKIS_HOME/sbin/ext/linkis-common-start -if [[ ! -f "${COMMON_START_BIN}" ]]; then - echo "The $COMMON_START_BIN does not exist!" - exit 1 -else - sh $COMMON_START_BIN -fi diff --git a/linkis-dist/package/sbin/ext/linkis-ps-metadataquery b/linkis-dist/package/sbin/ext/linkis-ps-metadataquery deleted file mode 100644 index 8bfeece41..000000000 --- a/linkis-dist/package/sbin/ext/linkis-ps-metadataquery +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# description: ps-metadataquery start cmd -# -# Modified for Linkis 1.1.0 -# - -export SERVER_SUFFIX="linkis-public-enhancements/linkis-ps-metadataquery" - -#export DEBUG_PORT= - -export SERVER_CLASS=org.apache.linkis.metadata.query.server.LinkisMetadataQueryApplication - -export COMMON_START_BIN=$LINKIS_HOME/sbin/ext/linkis-common-start -if [[ ! -f "${COMMON_START_BIN}" ]]; then - echo "The $COMMON_START_BIN does not exist!" - exit 1 -else - sh $COMMON_START_BIN -fi \ No newline at end of file diff --git a/linkis-spring-cloud-services/linkis-service-gateway/linkis-gateway-server-support/src/main/scala/org/apache/linkis/gateway/ujes/route/HaContextGatewayRouter.scala b/linkis-spring-cloud-services/linkis-service-gateway/linkis-gateway-server-support/src/main/scala/org/apache/linkis/gateway/ujes/route/HaContextGatewayRouter.scala index 8dbe7ca1c..5581965c9 100644 --- a/linkis-spring-cloud-services/linkis-service-gateway/linkis-gateway-server-support/src/main/scala/org/apache/linkis/gateway/ujes/route/HaContextGatewayRouter.scala +++ b/linkis-spring-cloud-services/linkis-service-gateway/linkis-gateway-server-support/src/main/scala/org/apache/linkis/gateway/ujes/route/HaContextGatewayRouter.scala @@ -36,7 +36,7 @@ import org.springframework.stereotype.Component import java.util -import scala.collection.JavaConversions._ +import scala.collection.JavaConverters._ import scala.util.Random import scala.util.matching.Regex @@ -55,15 +55,12 @@ class HaContextGatewayRouter extends AbstractGatewayRouter { if ( gatewayContext.getGatewayRoute.getRequestURI.contains( - HaContextGatewayRouter.CONTEXT_SERVICE_STR - ) || - gatewayContext.getGatewayRoute.getRequestURI.contains( - HaContextGatewayRouter.OLD_CONTEXT_SERVICE_PREFIX + HaContextGatewayRouter.CONTEXT_SERVICE_REQUEST_PREFIX ) ) { val params: util.HashMap[String, String] = gatewayContext.getGatewayRoute.getParams if (!gatewayContext.getRequest.getQueryParams.isEmpty) { - for ((k, vArr) <- gatewayContext.getRequest.getQueryParams) { + for ((k, vArr) <- gatewayContext.getRequest.getQueryParams.asScala) { if (vArr.nonEmpty) { params.putIfAbsent(k, vArr.head) } @@ -79,13 +76,13 @@ class HaContextGatewayRouter extends AbstractGatewayRouter { dealContextCreate(gatewayContext) } else { var contextId: String = null - for ((key, value) <- params) { + for ((key, value) <- params.asScala) { if (key.equalsIgnoreCase(ContextHTTPConstant.CONTEXT_ID_STR)) { contextId = value } } if (StringUtils.isNotBlank(contextId)) { - dealContextAccess(contextId.toString, gatewayContext) + dealContextAccess(contextId, gatewayContext) } else { dealContextCreate(gatewayContext) } @@ -97,9 +94,9 @@ class HaContextGatewayRouter extends AbstractGatewayRouter { def dealContextCreate(gatewayContext: GatewayContext): ServiceInstance = { val serviceId = findService( - HaContextGatewayRouter.CONTEXT_SERVICE_STR, + HaContextGatewayRouter.CONTEXT_SERVICE_NAME, list => { - val services = list.filter(_.contains(HaContextGatewayRouter.CONTEXT_SERVICE_STR)) + val services = list.filter(_.contains(HaContextGatewayRouter.CONTEXT_SERVICE_NAME)) services.headOption } ) @@ -137,9 +134,9 @@ class HaContextGatewayRouter extends AbstractGatewayRouter { val instances = contextIDParser.parse(contextId) var serviceId: Option[String] = None serviceId = findService( - HaContextGatewayRouter.CONTEXT_SERVICE_STR, + HaContextGatewayRouter.CONTEXT_SERVICE_NAME, list => { - val services = list.filter(_.contains(HaContextGatewayRouter.CONTEXT_SERVICE_STR)) + val services = list.filter(_.contains(HaContextGatewayRouter.CONTEXT_SERVICE_NAME)) services.headOption } ) @@ -159,10 +156,11 @@ class HaContextGatewayRouter extends AbstractGatewayRouter { object HaContextGatewayRouter { val CONTEXT_ID_STR: String = "contextId" - val CONTEXT_SERVICE_STR: String = "ps-cs" - @Deprecated - val OLD_CONTEXT_SERVICE_PREFIX = "contextservice" + // because the ps-cs service had merged to ps-publicservice, so change the serviceName to ps-publicservice + val CONTEXT_SERVICE_NAME: String = "ps-publicservice" + + val CONTEXT_SERVICE_REQUEST_PREFIX = "contextservice" val CONTEXT_REGEX: Regex = (normalPath(API_URL_PREFIX) + "rest_[a-zA-Z][a-zA-Z_0-9]*/(v\\d+)/contextservice/" + ".+").r --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
