@Test public void testBackwardCompatibility() { KylinConfig config = KylinConfig.getInstanceFromEnv(); final String oldk = "kylin.test.bcc.old.key"; final String newk = "kylin.test.bcc.new.key"; assertNull(config.getOptional(oldk)); assertNotNull(config.getOptional(newk)); Map<String, String> override = Maps.newHashMap(); override.put(oldk, "1"); KylinConfigExt ext = KylinConfigExt.createInstance(config, override); assertEquals(ext.getOptional(oldk), null); assertEquals(ext.getOptional(newk), "1"); assertNotEquals(config.getOptional(newk), "1"); config.setProperty(oldk, "2"); assertEquals(config.getOptional(newk), "2"); }
public static KylinConfig getInstanceFromEnv() { synchronized (KylinConfig.class) { KylinConfig config = THREAD_ENV_INSTANCE.get(); if (config != null) { return config; } if (SYS_ENV_INSTANCE == null) { try { buildDefaultOrderedProperties(); config = new KylinConfig(); config.reloadKylinConfig(buildSiteProperties()); VersionUtil.loadKylinVersion(); logger.info("Initialized a new KylinConfig from getInstanceFromEnv : {}", System.identityHashCode(config)); SYS_ENV_INSTANCE = config; } catch (IllegalArgumentException e) { throw new IllegalStateException("Failed to find KylinConfig ", e); } } return SYS_ENV_INSTANCE; } }
KylinConfig extends KylinConfigBase { public static KylinConfig getInstanceFromEnv() { synchronized (KylinConfig.class) { KylinConfig config = THREAD_ENV_INSTANCE.get(); if (config != null) { return config; } if (SYS_ENV_INSTANCE == null) { try { buildDefaultOrderedProperties(); config = new KylinConfig(); config.reloadKylinConfig(buildSiteProperties()); VersionUtil.loadKylinVersion(); logger.info("Initialized a new KylinConfig from getInstanceFromEnv : {}", System.identityHashCode(config)); SYS_ENV_INSTANCE = config; } catch (IllegalArgumentException e) { throw new IllegalStateException("Failed to find KylinConfig ", e); } } return SYS_ENV_INSTANCE; } } }
KylinConfig extends KylinConfigBase { public static KylinConfig getInstanceFromEnv() { synchronized (KylinConfig.class) { KylinConfig config = THREAD_ENV_INSTANCE.get(); if (config != null) { return config; } if (SYS_ENV_INSTANCE == null) { try { buildDefaultOrderedProperties(); config = new KylinConfig(); config.reloadKylinConfig(buildSiteProperties()); VersionUtil.loadKylinVersion(); logger.info("Initialized a new KylinConfig from getInstanceFromEnv : {}", System.identityHashCode(config)); SYS_ENV_INSTANCE = config; } catch (IllegalArgumentException e) { throw new IllegalStateException("Failed to find KylinConfig ", e); } } return SYS_ENV_INSTANCE; } } private  KylinConfig(); protected  KylinConfig(Properties props, boolean force); }
KylinConfig extends KylinConfigBase { public static KylinConfig getInstanceFromEnv() { synchronized (KylinConfig.class) { KylinConfig config = THREAD_ENV_INSTANCE.get(); if (config != null) { return config; } if (SYS_ENV_INSTANCE == null) { try { buildDefaultOrderedProperties(); config = new KylinConfig(); config.reloadKylinConfig(buildSiteProperties()); VersionUtil.loadKylinVersion(); logger.info("Initialized a new KylinConfig from getInstanceFromEnv : {}", System.identityHashCode(config)); SYS_ENV_INSTANCE = config; } catch (IllegalArgumentException e) { throw new IllegalStateException("Failed to find KylinConfig ", e); } } return SYS_ENV_INSTANCE; } } private  KylinConfig(); protected  KylinConfig(Properties props, boolean force); static File getKylinHomeAtBestEffort(); static KylinConfig getInstanceFromEnv(); static void destroyInstance(); static KylinConfig createInstanceFromUri(String uri); static Properties streamToProps(InputStream is); static void setKylinConfigInEnvIfMissing(Properties prop); static void setKylinConfigInEnvIfMissing(String propsInStr); static SetAndUnsetThreadLocalConfig setAndUnsetThreadLocalConfig(KylinConfig config); static KylinConfig createKylinConfig(String propsInStr); static KylinConfig createKylinConfig(KylinConfig another); static KylinConfig createKylinConfig(Properties prop); static File getKylinConfDir(); static void setSandboxEnvIfPossible(); T getManager(final Class<T> clz); void clearManagers(); Properties exportToProperties(); String exportAllToString(); String exportToString(Collection<String> propertyKeys); void exportToFile(File file); synchronized void reloadFromSiteProperties(); static String getConfigAsString(Configuration conf); static Configuration getConfigFromString(String configInStr); KylinConfig base(); @Override int hashCode(); @Override boolean equals(Object another); }
KylinConfig extends KylinConfigBase { public static KylinConfig getInstanceFromEnv() { synchronized (KylinConfig.class) { KylinConfig config = THREAD_ENV_INSTANCE.get(); if (config != null) { return config; } if (SYS_ENV_INSTANCE == null) { try { buildDefaultOrderedProperties(); config = new KylinConfig(); config.reloadKylinConfig(buildSiteProperties()); VersionUtil.loadKylinVersion(); logger.info("Initialized a new KylinConfig from getInstanceFromEnv : {}", System.identityHashCode(config)); SYS_ENV_INSTANCE = config; } catch (IllegalArgumentException e) { throw new IllegalStateException("Failed to find KylinConfig ", e); } } return SYS_ENV_INSTANCE; } } private  KylinConfig(); protected  KylinConfig(Properties props, boolean force); static File getKylinHomeAtBestEffort(); static KylinConfig getInstanceFromEnv(); static void destroyInstance(); static KylinConfig createInstanceFromUri(String uri); static Properties streamToProps(InputStream is); static void setKylinConfigInEnvIfMissing(Properties prop); static void setKylinConfigInEnvIfMissing(String propsInStr); static SetAndUnsetThreadLocalConfig setAndUnsetThreadLocalConfig(KylinConfig config); static KylinConfig createKylinConfig(String propsInStr); static KylinConfig createKylinConfig(KylinConfig another); static KylinConfig createKylinConfig(Properties prop); static File getKylinConfDir(); static void setSandboxEnvIfPossible(); T getManager(final Class<T> clz); void clearManagers(); Properties exportToProperties(); String exportAllToString(); String exportToString(Collection<String> propertyKeys); void exportToFile(File file); synchronized void reloadFromSiteProperties(); static String getConfigAsString(Configuration conf); static Configuration getConfigFromString(String configInStr); KylinConfig base(); @Override int hashCode(); @Override boolean equals(Object another); static final String KYLIN_CONF_PROPERTIES_FILE; static final String KYLIN_DEFAULT_CONF_PROPERTIES_FILE; static final String KYLIN_CONF; }