You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by ma...@apache.org on 2016/10/08 02:25:58 UTC

[36/50] [abbrv] kylin git commit: KYLIN-1962: Revert unsed split config feature

KYLIN-1962: Revert unsed split config feature

Signed-off-by: shaofengshi <sh...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/51b5b31b
Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/51b5b31b
Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/51b5b31b

Branch: refs/heads/orderedbytes
Commit: 51b5b31bbce3aac1d3a3c0de7746334961d5ffcd
Parents: 0fd4ad5
Author: Yiming Liu <li...@gmail.com>
Authored: Tue Sep 27 07:52:52 2016 +0800
Committer: shaofengshi <sh...@apache.org>
Committed: Wed Sep 28 17:51:49 2016 +0800

----------------------------------------------------------------------
 .../org/apache/kylin/common/KylinConfig.java    | 45 ---------------
 .../apache/kylin/common/KylinConfigTest.java    | 12 ----
 .../test_case_data/localmeta/kylin.properties   | 33 ++++++++++-
 .../localmeta/kylin_account.properties          | 59 --------------------
 .../org/apache/kylin/tool/DiagnosisInfoCLI.java |  4 +-
 5 files changed, 33 insertions(+), 120 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/51b5b31b/core-common/src/main/java/org/apache/kylin/common/KylinConfig.java
----------------------------------------------------------------------
diff --git a/core-common/src/main/java/org/apache/kylin/common/KylinConfig.java b/core-common/src/main/java/org/apache/kylin/common/KylinConfig.java
index f134ad4..9543fc7 100644
--- a/core-common/src/main/java/org/apache/kylin/common/KylinConfig.java
+++ b/core-common/src/main/java/org/apache/kylin/common/KylinConfig.java
@@ -47,7 +47,6 @@ public class KylinConfig extends KylinConfigBase {
 
     /** Kylin properties file name */
     public static final String KYLIN_CONF_PROPERTIES_FILE = "kylin.properties";
-    public static final String KYLIN_ACCOUNT_CONF_PROPERTIES_FILE = "kylin_account.properties";
     public static final String KYLIN_CONF = "KYLIN_CONF";
 
     // static cached instances
@@ -205,23 +204,6 @@ public class KylinConfig extends KylinConfigBase {
         return getKylinPropertiesFile(path);
     }
 
-    static File getKylinAccountPropertiesFile() {
-        String kylinConfHome = System.getProperty(KYLIN_CONF);
-        if (!StringUtils.isEmpty(kylinConfHome)) {
-            logger.info("Use KYLIN_CONF=" + kylinConfHome);
-            return getKylinAccountPropertiesFile(kylinConfHome);
-        }
-
-        logger.warn("KYLIN_CONF property was not set, will seek KYLIN_HOME env variable");
-
-        String kylinHome = getKylinHome();
-        if (StringUtils.isEmpty(kylinHome))
-            throw new KylinConfigCannotInitException("Didn't find KYLIN_CONF or KYLIN_HOME, please set one of them");
-
-        String path = kylinHome + File.separator + "conf";
-        return getKylinAccountPropertiesFile(path);
-    }
-
     public static Properties getKylinProperties() {
         File propFile = getKylinPropertiesFile();
         if (propFile == null || !propFile.exists()) {
@@ -242,25 +224,6 @@ public class KylinConfig extends KylinConfigBase {
                 IOUtils.closeQuietly(ois);
                 conf.putAll(propOverride);
             }
-
-            File accountPropFile = getKylinAccountPropertiesFile();
-            if (accountPropFile.exists()) {
-                FileInputStream ois = new FileInputStream(accountPropFile);
-                Properties propAccount = new Properties();
-                propAccount.load(ois);
-                IOUtils.closeQuietly(ois);
-                conf.putAll(propAccount);
-            }
-
-            File accountPropOverrideFile = new File(accountPropFile.getParentFile(), accountPropFile.getName() + ".override");
-            if (accountPropOverrideFile.exists()) {
-                FileInputStream ois = new FileInputStream(accountPropOverrideFile);
-                Properties propAccountOverride = new Properties();
-                propAccountOverride.load(ois);
-                IOUtils.closeQuietly(ois);
-                conf.putAll(propAccountOverride);
-            }
-
         } catch (IOException e) {
             throw new RuntimeException(e);
         }
@@ -282,14 +245,6 @@ public class KylinConfig extends KylinConfigBase {
         return new File(path, KYLIN_CONF_PROPERTIES_FILE);
     }
 
-    private static File getKylinAccountPropertiesFile(String path) {
-        if (path == null) {
-            return null;
-        }
-
-        return new File(path, KYLIN_ACCOUNT_CONF_PROPERTIES_FILE);
-    }
-
     public static void setSandboxEnvIfPossible() {
         File dir1 = new File("../examples/test_case_data/sandbox");
         File dir2 = new File("../../kylin/examples/test_case_data/sandbox");

http://git-wip-us.apache.org/repos/asf/kylin/blob/51b5b31b/core-common/src/test/java/org/apache/kylin/common/KylinConfigTest.java
----------------------------------------------------------------------
diff --git a/core-common/src/test/java/org/apache/kylin/common/KylinConfigTest.java b/core-common/src/test/java/org/apache/kylin/common/KylinConfigTest.java
index 0e11c22..097fe11 100644
--- a/core-common/src/test/java/org/apache/kylin/common/KylinConfigTest.java
+++ b/core-common/src/test/java/org/apache/kylin/common/KylinConfigTest.java
@@ -48,16 +48,4 @@ public class KylinConfigTest extends LocalFileMetadataTestCase {
         assertEquals("test2", override.get("test2"));
     }
 
-    @Test
-    public void testAccountConfig() {
-        KylinConfig config = KylinConfig.getInstanceFromEnv();
-        assertEquals("need_reset", config.getMailPassword());
-    }
-
-    @Test
-    public void testAccountOverrideConfig(){
-        KylinConfig config = KylinConfig.getInstanceFromEnv();
-        assertEquals("override.mail.com", config.getMailHost());
-    }
-
 }

http://git-wip-us.apache.org/repos/asf/kylin/blob/51b5b31b/examples/test_case_data/localmeta/kylin.properties
----------------------------------------------------------------------
diff --git a/examples/test_case_data/localmeta/kylin.properties b/examples/test_case_data/localmeta/kylin.properties
index 866a518..678da39 100644
--- a/examples/test_case_data/localmeta/kylin.properties
+++ b/examples/test_case_data/localmeta/kylin.properties
@@ -84,10 +84,41 @@ kylin.job.yarn.app.rest.check.interval.seconds=10
 # with "testing" profile, user can use pre-defined name/pwd like KYLIN/ADMIN to login
 kylin.security.profile=testing
 
+# Default roles and admin roles in LDAP, for ldap and saml
+acl.defaultRole=ROLE_ANALYST,ROLE_MODELER
+acl.adminRole=ROLE_ADMIN
+
+# LDAP authentication configuration
+ldap.server=ldap://ldap_server:389
+ldap.username=
+ldap.password=
+
+# LDAP user account directory;
+ldap.user.searchBase=
+ldap.user.searchPattern=
+ldap.user.groupSearchBase=
+
+# LDAP service account directory
+ldap.service.searchBase=
+ldap.service.searchPattern=
+ldap.service.groupSearchBase=
+
+# SAML configurations for SSO
+# SAML IDP metadata file location
+saml.metadata.file=classpath:sso_metadata.xml
+saml.metadata.entityBaseURL=https://hostname/kylin
+saml.context.scheme=https
+saml.context.serverName=hostname
+saml.context.serverPort=443
+saml.context.contextPath=/kylin
+
 ### MAIL ###
 # If true, will send email notification;
 mail.enabled=false
-mail.host=origin.mail.com
+mail.host=mail.com
+mail.username=
+mail.password=need_reset
+mail.sender=
 
 ### OTHER ###
 

http://git-wip-us.apache.org/repos/asf/kylin/blob/51b5b31b/examples/test_case_data/localmeta/kylin_account.properties
----------------------------------------------------------------------
diff --git a/examples/test_case_data/localmeta/kylin_account.properties b/examples/test_case_data/localmeta/kylin_account.properties
deleted file mode 100644
index ac34172..0000000
--- a/examples/test_case_data/localmeta/kylin_account.properties
+++ /dev/null
@@ -1,59 +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.
-#
-
-### JOB ###
-
-# Only necessary when kylin.job.run.as.remote.cmd=true
-kylin.job.remote.cli.username=
-
-# Only necessary when kylin.job.run.as.remote.cmd=true
-kylin.job.remote.cli.password=
-
-### SECURITY ###
-# Default roles and admin roles in LDAP, for ldap and saml
-acl.defaultRole=ROLE_ANALYST,ROLE_MODELER
-acl.adminRole=ROLE_ADMIN
-
-# LDAP authentication configuration
-ldap.server=ldap://ldap_server:389
-ldap.username=
-ldap.password=
-
-# LDAP user account directory;
-ldap.user.searchBase=
-ldap.user.searchPattern=
-ldap.user.groupSearchBase=
-
-# LDAP service account directory
-ldap.service.searchBase=
-ldap.service.searchPattern=
-ldap.service.groupSearchBase=
-
-# SAML configurations for SSO
-# SAML IDP metadata file location
-saml.metadata.file=classpath:sso_metadata.xml
-saml.metadata.entityBaseURL=https://hostname/kylin
-saml.context.scheme=https
-saml.context.serverName=hostname
-saml.context.serverPort=443
-saml.context.contextPath=/kylin
-
-### MAIL ###
-mail.host=override.mail.com
-mail.username=
-mail.password=need_reset
-mail.sender=
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/kylin/blob/51b5b31b/tool/src/main/java/org/apache/kylin/tool/DiagnosisInfoCLI.java
----------------------------------------------------------------------
diff --git a/tool/src/main/java/org/apache/kylin/tool/DiagnosisInfoCLI.java b/tool/src/main/java/org/apache/kylin/tool/DiagnosisInfoCLI.java
index f93aaf2..94fccf8 100644
--- a/tool/src/main/java/org/apache/kylin/tool/DiagnosisInfoCLI.java
+++ b/tool/src/main/java/org/apache/kylin/tool/DiagnosisInfoCLI.java
@@ -184,9 +184,7 @@ public class DiagnosisInfoCLI extends AbstractInfoExtractor {
                         File[] confFiles = srcConfDir.listFiles();
                         if (confFiles != null) {
                             for (File confFile : confFiles) {
-                                if (!KylinConfig.KYLIN_ACCOUNT_CONF_PROPERTIES_FILE.equals(confFile.getName())) {
-                                    FileUtils.copyFileToDirectory(confFile, destConfDir);
-                                }
+                                FileUtils.copyFileToDirectory(confFile, destConfDir);
                             }
                         }
                     } catch (Exception e) {