Java Code Examples for org.apache.kylin.common.KylinConfig#getKylinHome()
The following examples show how to use
org.apache.kylin.common.KylinConfig#getKylinHome() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DiagnosisService.java From kylin with Apache License 2.0 | 6 votes |
private void runDiagnosisCLI(String[] args) throws IOException { Message msg = MsgPicker.getMsg(); File cwd = new File(""); logger.debug("Current path: {}", cwd.getAbsolutePath()); logger.debug("DiagnosisInfoCLI args: {}", Arrays.toString(args)); File script = new File(KylinConfig.getKylinHome() + File.separator + "bin", "diag.sh"); if (!script.exists()) { throw new BadRequestException( String.format(Locale.ROOT, msg.getDIAG_NOT_FOUND(), script.getAbsolutePath())); } String diagCmd = script.getAbsolutePath() + " " + StringUtils.join(args, " "); CliCommandExecutor executor = KylinConfig.getInstanceFromEnv().getCliCommandExecutor(); Pair<Integer, String> cmdOutput = executor.execute(diagCmd); if (cmdOutput.getFirst() != 0) { throw new BadRequestException(msg.getGENERATE_DIAG_PACKAGE_FAIL()); } }
Example 2
Source File: KafkaConsumerProperties.java From kylin with Apache License 2.0 | 6 votes |
private File getKafkaConsumerFile() { String kylinConfHome = System.getProperty(KylinConfig.KYLIN_CONF); if (!StringUtils.isEmpty(kylinConfHome)) { logger.info("Use KYLIN_CONF={}", kylinConfHome); return getKafkaConsumerFile(kylinConfHome); } logger.warn("KYLIN_CONF property was not set, will seek KYLIN_HOME env variable"); String kylinHome = KylinConfig.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 getKafkaConsumerFile(path); }
Example 3
Source File: StreamingServer.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
private String calLocalSegmentCacheDir() { String kylinHome = KylinConfig.getKylinHome(); String indexPathStr = KylinConfig.getInstanceFromEnv().getStreamingIndexPath(); String localSegmentCachePath; File indexPath = new File(indexPathStr); if (indexPath.isAbsolute()) { localSegmentCachePath = indexPathStr; } else { if (kylinHome != null && !kylinHome.equals("")) { File localSegmentFile = new File(kylinHome, indexPathStr); localSegmentCachePath = localSegmentFile.getAbsolutePath(); } else { localSegmentCachePath = indexPathStr; } } logger.info("Using {} to store local segment cache.", localSegmentCachePath); return localSegmentCachePath; }
Example 4
Source File: KafkaConsumerProperties.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
private File getKafkaConsumerFile() { String kylinConfHome = System.getProperty(KylinConfig.KYLIN_CONF); if (!StringUtils.isEmpty(kylinConfHome)) { logger.info("Use KYLIN_CONF={}", kylinConfHome); return getKafkaConsumerFile(kylinConfHome); } logger.warn("KYLIN_CONF property was not set, will seek KYLIN_HOME env variable"); String kylinHome = KylinConfig.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 getKafkaConsumerFile(path); }
Example 5
Source File: DiagnosisService.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
private void runDiagnosisCLI(String[] args) throws IOException { Message msg = MsgPicker.getMsg(); File cwd = new File(""); logger.debug("Current path: {}", cwd.getAbsolutePath()); logger.debug("DiagnosisInfoCLI args: {}", Arrays.toString(args)); File script = new File(KylinConfig.getKylinHome() + File.separator + "bin", "diag.sh"); if (!script.exists()) { throw new BadRequestException( String.format(Locale.ROOT, msg.getDIAG_NOT_FOUND(), script.getAbsolutePath())); } String diagCmd = script.getAbsolutePath() + " " + StringUtils.join(args, " "); CliCommandExecutor executor = KylinConfig.getInstanceFromEnv().getCliCommandExecutor(); Pair<Integer, String> cmdOutput = executor.execute(diagCmd); if (cmdOutput.getFirst() != 0) { throw new BadRequestException(msg.getGENERATE_DIAG_PACKAGE_FAIL()); } }
Example 6
Source File: StreamingServer.java From kylin with Apache License 2.0 | 6 votes |
private String calLocalSegmentCacheDir() { String kylinHome = KylinConfig.getKylinHome(); String indexPathStr = KylinConfig.getInstanceFromEnv().getStreamingIndexPath(); String localSegmentCachePath; File indexPath = new File(indexPathStr); if (indexPath.isAbsolute()) { localSegmentCachePath = indexPathStr; } else { if (kylinHome != null && !kylinHome.equals("")) { File localSegmentFile = new File(kylinHome, indexPathStr); localSegmentCachePath = localSegmentFile.getAbsolutePath(); } else { localSegmentCachePath = indexPathStr; } } logger.info("Using {} to store local segment cache.", localSegmentCachePath); return localSegmentCachePath; }
Example 7
Source File: AbstractInfoExtractor.java From kylin with Apache License 2.0 | 6 votes |
private void dumpBasicDiagInfo() throws IOException { try { for (String commitSHA1File : COMMIT_SHA1_FILES) { File commitFile = new File(KylinConfig.getKylinHome(), commitSHA1File); if (commitFile.exists()) { FileUtils.copyFileToDirectory(commitFile, exportDir); } } } catch (IOException e) { logger.warn("Failed to copy commit_SHA1 file.", e); } String output = KylinVersion.getKylinClientInformation() + "\n"; FileUtils.writeStringToFile(new File(exportDir, "kylin_env"), output, Charset.defaultCharset()); StringBuilder basicSb = new StringBuilder(); basicSb.append("MetaStoreID: ").append(ToolUtil.getMetaStoreId()).append("\n"); basicSb.append("PackageType: ").append(packageType.toUpperCase(Locale.ROOT)).append("\n"); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z", Locale.ROOT); basicSb.append("PackageTimestamp: ").append(format.format(new Date())).append("\n"); basicSb.append("Host: ").append(ToolUtil.getHostName()).append("\n"); FileUtils.writeStringToFile(new File(exportDir, "info"), basicSb.toString(), Charset.defaultCharset()); }
Example 8
Source File: ToolUtil.java From kylin with Apache License 2.0 | 5 votes |
public static String getConfFolder() { final String CONF = "conf"; String path = System.getProperty(KylinConfig.KYLIN_CONF); if (StringUtils.isNotEmpty(path)) { return path; } path = KylinConfig.getKylinHome(); if (StringUtils.isNotEmpty(path)) { return path + File.separator + CONF; } throw new RuntimeException("Cannot find conf folder."); }
Example 9
Source File: JobEngineConfig.java From kylin with Apache License 2.0 | 5 votes |
private static File getJobConfig(String fileName) { String path = System.getProperty(KylinConfig.KYLIN_CONF); if (StringUtils.isNotEmpty(path)) { return new File(path, fileName); } path = KylinConfig.getKylinHome(); if (StringUtils.isNotEmpty(path)) { return new File(path + File.separator + "conf", fileName); } return null; }
Example 10
Source File: DataSourceDefProvider.java From kylin with Apache License 2.0 | 5 votes |
private DataSourceDef loadDataSourceFromDir(String id) { String resourcePath = KylinConfig.getKylinHome() + "/conf/datasource/" + id + ".xml"; try (InputStream is = new FileInputStream(resourcePath)) { DataSourceDef ds = XmlUtil.readValue(is, DataSourceDef.class); ds.init(); return ds; } catch (IOException e) { logger.error("[Dev Only] Failed to load data source from directory.: Path={}", resourcePath, e.getMessage()); return null; } }
Example 11
Source File: RocksDBLookupTableCache.java From kylin with Apache License 2.0 | 5 votes |
protected static String getCacheBasePath(KylinConfig config) { String basePath = config.getExtTableSnapshotLocalCachePath(); if ((!basePath.startsWith("/")) && (KylinConfig.getKylinHome() != null)) { basePath = KylinConfig.getKylinHome() + File.separator + basePath; } return basePath + File.separator + CACHE_TYPE_ROCKSDB; }
Example 12
Source File: StreamingReceiver.java From kylin with Apache License 2.0 | 5 votes |
private String getLogDir(KylinConfig kylinConfig) { String kylinHome = kylinConfig.getKylinHome(); if (kylinHome == null) { kylinHome = System.getProperty("KYLIN_HOME"); } return kylinHome + File.separator + "logs"; }
Example 13
Source File: AbstractInfoExtractor.java From kylin with Apache License 2.0 | 5 votes |
public static String getKylinHome() { String path = System.getProperty(KylinConfig.KYLIN_CONF); if (StringUtils.isNotEmpty(path)) { return path; } path = KylinConfig.getKylinHome(); if (StringUtils.isNotEmpty(path)) { return path; } throw new RuntimeException("Cannot find KYLIN_HOME."); }
Example 14
Source File: ToolUtil.java From kylin-on-parquet-v2 with Apache License 2.0 | 5 votes |
public static String getConfFolder() { final String CONF = "conf"; String path = System.getProperty(KylinConfig.KYLIN_CONF); if (StringUtils.isNotEmpty(path)) { return path; } path = KylinConfig.getKylinHome(); if (StringUtils.isNotEmpty(path)) { return path + File.separator + CONF; } throw new RuntimeException("Cannot find conf folder."); }
Example 15
Source File: JobEngineConfig.java From kylin-on-parquet-v2 with Apache License 2.0 | 5 votes |
private static File getJobConfig(String fileName) { String path = System.getProperty(KylinConfig.KYLIN_CONF); if (StringUtils.isNotEmpty(path)) { return new File(path, fileName); } path = KylinConfig.getKylinHome(); if (StringUtils.isNotEmpty(path)) { return new File(path + File.separator + "conf", fileName); } return null; }
Example 16
Source File: DataSourceDefProvider.java From kylin-on-parquet-v2 with Apache License 2.0 | 5 votes |
private DataSourceDef loadDataSourceFromDir(String id) { String resourcePath = KylinConfig.getKylinHome() + "/conf/datasource/" + id + ".xml"; try (InputStream is = new FileInputStream(resourcePath)) { DataSourceDef ds = XmlUtil.readValue(is, DataSourceDef.class); ds.init(); return ds; } catch (IOException e) { logger.error("[Dev Only] Failed to load data source from directory.: Path={}", resourcePath, e.getMessage()); return null; } }
Example 17
Source File: RocksDBLookupTableCache.java From kylin-on-parquet-v2 with Apache License 2.0 | 5 votes |
protected static String getCacheBasePath(KylinConfig config) { String basePath = config.getExtTableSnapshotLocalCachePath(); if ((!basePath.startsWith("/")) && (KylinConfig.getKylinHome() != null)) { basePath = KylinConfig.getKylinHome() + File.separator + basePath; } return basePath + File.separator + CACHE_TYPE_ROCKSDB; }
Example 18
Source File: StreamingReceiver.java From kylin-on-parquet-v2 with Apache License 2.0 | 5 votes |
private String getLogDir(KylinConfig kylinConfig) { String kylinHome = kylinConfig.getKylinHome(); if (kylinHome == null) { kylinHome = System.getProperty("KYLIN_HOME"); } return kylinHome + File.separator + "logs"; }
Example 19
Source File: AbstractInfoExtractor.java From kylin-on-parquet-v2 with Apache License 2.0 | 5 votes |
public static String getKylinHome() { String path = System.getProperty(KylinConfig.KYLIN_CONF); if (StringUtils.isNotEmpty(path)) { return path; } path = KylinConfig.getKylinHome(); if (StringUtils.isNotEmpty(path)) { return path; } throw new RuntimeException("Cannot find KYLIN_HOME."); }
Example 20
Source File: JobEngineConfig.java From Kylin with Apache License 2.0 | 5 votes |
private static File getJobConfig(String fileName) { String path = System.getProperty(KylinConfig.KYLIN_CONF); if (StringUtils.isNotEmpty(path)) { return new File(path, fileName); } path = KylinConfig.getKylinHome(); if (StringUtils.isNotEmpty(path)) { return new File(path + File.separator + "conf", fileName); } return null; }