You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@linkis.apache.org by pe...@apache.org on 2022/03/14 15:36:15 UTC

[incubator-linkis] 03/03: 1. format the code.

This is an automated email from the ASF dual-hosted git repository.

peacewong pushed a commit to branch dev-1.1.1
in repository https://gitbox.apache.org/repos/asf/incubator-linkis.git

commit 040940a6661e17215389d6a4311ae9b310c676ce
Author: alexkun <xu...@qq.com>
AuthorDate: Mon Mar 14 23:03:02 2022 +0800

    1. format the code.
---
 .../cs/persistence/conf/PersistenceConf.java       | 10 ++++---
 .../persistence/impl/ContextIDPersistenceImpl.java | 33 ++++++++++++++++++----
 .../impl/ContextMapPersistenceImpl.java            | 31 ++++++++++++++++----
 3 files changed, 58 insertions(+), 16 deletions(-)

diff --git a/linkis-public-enhancements/linkis-context-service/linkis-cs-persistence/src/main/java/org/apache/linkis/cs/persistence/conf/PersistenceConf.java b/linkis-public-enhancements/linkis-context-service/linkis-cs-persistence/src/main/java/org/apache/linkis/cs/persistence/conf/PersistenceConf.java
index 0897081..7739d0f 100644
--- a/linkis-public-enhancements/linkis-context-service/linkis-cs-persistence/src/main/java/org/apache/linkis/cs/persistence/conf/PersistenceConf.java
+++ b/linkis-public-enhancements/linkis-context-service/linkis-cs-persistence/src/main/java/org/apache/linkis/cs/persistence/conf/PersistenceConf.java
@@ -17,7 +17,6 @@
 
 package org.apache.linkis.cs.persistence.conf;
 
-import com.sun.org.apache.xpath.internal.operations.Bool;
 import org.apache.linkis.common.conf.CommonVars;
 
 public class PersistenceConf {
@@ -32,10 +31,13 @@ public class PersistenceConf {
     public static final CommonVars<String> TUNING_METHOD =
             CommonVars.apply("wds.linkis.cs.ha.proxymethod", "getContextHAProxy");
 
-    public static final CommonVars<Boolean> ENABLE_CS_DESERIALIZE_REPLACE_PACKAGE_HEADER = CommonVars.apply("wds.linkis.cs.deserialize.replace_package_header.enable", false);
+    public static final CommonVars<Boolean> ENABLE_CS_DESERIALIZE_REPLACE_PACKAGE_HEADER =
+            CommonVars.apply("wds.linkis.cs.deserialize.replace_package_header.enable", false);
 
-    public static final CommonVars<String> CS_DESERIALIZE_REPLACE_PACKAGE_HEADER = CommonVars.apply("wds.linkis.cs.deserialize.replace_package.header", "com.webank.wedatasphere.linkis");
+    public static final CommonVars<String> CS_DESERIALIZE_REPLACE_PACKAGE_HEADER =
+            CommonVars.apply(
+                    "wds.linkis.cs.deserialize.replace_package.header",
+                    "com.webank.wedatasphere.linkis");
 
     public static final String CSID_PACKAGE_HEADER = "org.apache.linkis";
-
 }
diff --git a/linkis-public-enhancements/linkis-context-service/linkis-cs-persistence/src/main/java/org/apache/linkis/cs/persistence/persistence/impl/ContextIDPersistenceImpl.java b/linkis-public-enhancements/linkis-context-service/linkis-cs-persistence/src/main/java/org/apache/linkis/cs/persistence/persistence/impl/ContextIDPersistenceImpl.java
index fdbc3e3..820fc71 100644
--- a/linkis-public-enhancements/linkis-context-service/linkis-cs-persistence/src/main/java/org/apache/linkis/cs/persistence/persistence/impl/ContextIDPersistenceImpl.java
+++ b/linkis-public-enhancements/linkis-context-service/linkis-cs-persistence/src/main/java/org/apache/linkis/cs/persistence/persistence/impl/ContextIDPersistenceImpl.java
@@ -17,7 +17,6 @@
 
 package org.apache.linkis.cs.persistence.persistence.impl;
 
-import org.apache.commons.lang3.StringUtils;
 import org.apache.linkis.cs.common.entity.source.ContextID;
 import org.apache.linkis.cs.common.exception.CSErrorException;
 import org.apache.linkis.cs.persistence.conf.PersistenceConf;
@@ -28,6 +27,7 @@ import org.apache.linkis.cs.persistence.persistence.ContextIDPersistence;
 import org.apache.linkis.cs.persistence.util.PersistenceUtils;
 import org.apache.linkis.server.BDPJettyServerHelper;
 
+import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.math3.util.Pair;
 
 import org.springframework.beans.factory.annotation.Autowired;
@@ -85,14 +85,35 @@ public class ContextIDPersistenceImpl implements ContextIDPersistence {
             PersistenceContextID pContextID = contextIDMapper.getContextID(contextId);
             if (pContextID == null) return null;
             if (PersistenceConf.ENABLE_CS_DESERIALIZE_REPLACE_PACKAGE_HEADER.getValue()) {
-                if (StringUtils.isBlank(pContextID.getSource()) || StringUtils.isBlank(PersistenceConf.CS_DESERIALIZE_REPLACE_PACKAGE_HEADER.getValue())) {
-                    logger.error("Source : {} of ContextID or CSID_REPLACE_PACKAGE_HEADER : {} cannot be empty.", pContextID.getSource(), PersistenceConf.CS_DESERIALIZE_REPLACE_PACKAGE_HEADER.getValue());
+                if (StringUtils.isBlank(pContextID.getSource())
+                        || StringUtils.isBlank(
+                                PersistenceConf.CS_DESERIALIZE_REPLACE_PACKAGE_HEADER.getValue())) {
+                    logger.error(
+                            "Source : {} of ContextID or CSID_REPLACE_PACKAGE_HEADER : {} cannot be empty.",
+                            pContextID.getSource(),
+                            PersistenceConf.CS_DESERIALIZE_REPLACE_PACKAGE_HEADER.getValue());
                 } else {
-                    if (pContextID.getSource().contains(PersistenceConf.CS_DESERIALIZE_REPLACE_PACKAGE_HEADER.getValue())) {
+                    if (pContextID
+                            .getSource()
+                            .contains(
+                                    PersistenceConf.CS_DESERIALIZE_REPLACE_PACKAGE_HEADER
+                                            .getValue())) {
                         if (logger.isDebugEnabled()) {
-                            logger.debug("Will replace package header of source : {} from : {} to : {}", pContextID.getSource(), PersistenceConf.CS_DESERIALIZE_REPLACE_PACKAGE_HEADER.getValue(), PersistenceConf.CSID_PACKAGE_HEADER);
+                            logger.debug(
+                                    "Will replace package header of source : {} from : {} to : {}",
+                                    pContextID.getSource(),
+                                    PersistenceConf.CS_DESERIALIZE_REPLACE_PACKAGE_HEADER
+                                            .getValue(),
+                                    PersistenceConf.CSID_PACKAGE_HEADER);
                         }
-                        pContextID.setSource(pContextID.getSource().replaceAll(PersistenceConf.CS_DESERIALIZE_REPLACE_PACKAGE_HEADER.getValue(), PersistenceConf.CSID_PACKAGE_HEADER));
+                        pContextID.setSource(
+                                pContextID
+                                        .getSource()
+                                        .replaceAll(
+                                                PersistenceConf
+                                                        .CS_DESERIALIZE_REPLACE_PACKAGE_HEADER
+                                                        .getValue(),
+                                                PersistenceConf.CSID_PACKAGE_HEADER));
                     }
                 }
             }
diff --git a/linkis-public-enhancements/linkis-context-service/linkis-cs-persistence/src/main/java/org/apache/linkis/cs/persistence/persistence/impl/ContextMapPersistenceImpl.java b/linkis-public-enhancements/linkis-context-service/linkis-cs-persistence/src/main/java/org/apache/linkis/cs/persistence/persistence/impl/ContextMapPersistenceImpl.java
index ebe5cad..38235bf 100644
--- a/linkis-public-enhancements/linkis-context-service/linkis-cs-persistence/src/main/java/org/apache/linkis/cs/persistence/persistence/impl/ContextMapPersistenceImpl.java
+++ b/linkis-public-enhancements/linkis-context-service/linkis-cs-persistence/src/main/java/org/apache/linkis/cs/persistence/persistence/impl/ContextMapPersistenceImpl.java
@@ -17,7 +17,6 @@
 
 package org.apache.linkis.cs.persistence.persistence.impl;
 
-import org.apache.commons.lang3.StringUtils;
 import org.apache.linkis.cs.common.entity.enumeration.ContextScope;
 import org.apache.linkis.cs.common.entity.enumeration.ContextType;
 import org.apache.linkis.cs.common.entity.source.ContextID;
@@ -37,6 +36,7 @@ import org.apache.linkis.cs.persistence.persistence.ContextMapPersistence;
 import org.apache.linkis.cs.persistence.util.PersistenceUtils;
 import org.apache.linkis.server.BDPJettyServerHelper;
 
+import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.math3.util.Pair;
 
 import org.springframework.beans.factory.annotation.Autowired;
@@ -125,14 +125,33 @@ public class ContextMapPersistenceImpl implements ContextMapPersistence {
             PersistenceContextKey pK = (PersistenceContextKey) pKV.getContextKey();
             PersistenceContextValue pV = (PersistenceContextValue) pKV.getContextValue();
             if (PersistenceConf.ENABLE_CS_DESERIALIZE_REPLACE_PACKAGE_HEADER.getValue()) {
-                if (StringUtils.isBlank(pKV.getProps()) || StringUtils.isBlank(PersistenceConf.CS_DESERIALIZE_REPLACE_PACKAGE_HEADER.getValue())) {
-                    logger.error("Props : {} of ContextMap or CSID_REPLACE_PACKAGE_HEADER : {} cannot be empty.", pKV.getProps(), PersistenceConf.CS_DESERIALIZE_REPLACE_PACKAGE_HEADER.getValue());
+                if (StringUtils.isBlank(pKV.getProps())
+                        || StringUtils.isBlank(
+                                PersistenceConf.CS_DESERIALIZE_REPLACE_PACKAGE_HEADER.getValue())) {
+                    logger.error(
+                            "Props : {} of ContextMap or CSID_REPLACE_PACKAGE_HEADER : {} cannot be empty.",
+                            pKV.getProps(),
+                            PersistenceConf.CS_DESERIALIZE_REPLACE_PACKAGE_HEADER.getValue());
                 } else {
-                    if (pKV.getProps().contains(PersistenceConf.CS_DESERIALIZE_REPLACE_PACKAGE_HEADER.getValue())) {
+                    if (pKV.getProps()
+                            .contains(
+                                    PersistenceConf.CS_DESERIALIZE_REPLACE_PACKAGE_HEADER
+                                            .getValue())) {
                         if (logger.isDebugEnabled()) {
-                            logger.debug("Will replace package header of source : {} from : {} to : {}", pKV.getProps(), PersistenceConf.CS_DESERIALIZE_REPLACE_PACKAGE_HEADER.getValue(), PersistenceConf.CSID_PACKAGE_HEADER);
+                            logger.debug(
+                                    "Will replace package header of source : {} from : {} to : {}",
+                                    pKV.getProps(),
+                                    PersistenceConf.CS_DESERIALIZE_REPLACE_PACKAGE_HEADER
+                                            .getValue(),
+                                    PersistenceConf.CSID_PACKAGE_HEADER);
                         }
-                        pKV.setProps(pKV.getProps().replaceAll(PersistenceConf.CS_DESERIALIZE_REPLACE_PACKAGE_HEADER.getValue(), PersistenceConf.CSID_PACKAGE_HEADER));
+                        pKV.setProps(
+                                pKV.getProps()
+                                        .replaceAll(
+                                                PersistenceConf
+                                                        .CS_DESERIALIZE_REPLACE_PACKAGE_HEADER
+                                                        .getValue(),
+                                                PersistenceConf.CSID_PACKAGE_HEADER));
                     }
                 }
             }

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@linkis.apache.org
For additional commands, e-mail: commits-help@linkis.apache.org