本文整理了Java中org.apache.kylin.common.persistence.ResourceStore.collectResourceRecursively
方法的一些代码示例,展示了ResourceStore.collectResourceRecursively
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ResourceStore.collectResourceRecursively
方法的具体详情如下:
包路径:org.apache.kylin.common.persistence.ResourceStore
类名称:ResourceStore
方法名:collectResourceRecursively
[英]Collect resources recursively under a folder, return empty list if folder does not exist
[中]在文件夹下递归收集资源,如果文件夹不存在,则返回空列表
代码示例来源:origin: apache/kylin
protected NavigableSet<String> listResourcesRecursivelyImpl(String folderPath) throws IOException {
List<String> list = collectResourceRecursively(folderPath, null);
if (list.isEmpty())
return null;
else
return new TreeSet<String>(list);
}
代码示例来源:origin: apache/kylin
protected List<String> listResourceStore(String pathRoot) {
List<String> paths = null;
try {
paths = store.collectResourceRecursively(pathRoot, MetadataConstants.FILE_SURFIX);
} catch (IOException e1) {
logger.error("error", e1);
errorMsgs.add("Get IOException when scan resource store at: " + ResourceStore.CUBE_DESC_RESOURCE_ROOT);
}
return paths;
}
代码示例来源:origin: apache/kylin
protected NavigableSet<String> listResourcesImpl(String folderPath) throws IOException {
List<String> list = collectResourceRecursively(folderPath, null);
if (list.isEmpty())
return null;
TreeSet<String> result = new TreeSet();
String root = norm(folderPath);
for (String p : list) {
int cut = p.indexOf('/', root.length() + 1);
result.add(cut < 0 ? p : p.substring(0, cut));
}
return result;
}
代码示例来源:origin: apache/kylin
public void reloadAll() throws IOException {
logger.debug("Reloading " + entityType.getSimpleName() + " from " + store.getReadableResourcePath(resRootPath));
cache.clear();
List<String> paths = store.collectResourceRecursively(resRootPath, resPathSuffix);
for (String path : paths) {
reloadQuietlyAt(path);
}
logger.debug("Loaded " + cache.size() + " " + entityType.getSimpleName() + "(s) out of " + paths.size()
+ " resource");
}
代码示例来源:origin: apache/kylin
private List<String> getCompatibleTablePath(Set<TableRef> tableRefs, String project, String rootPath)
throws IOException {
List<String> toResource = new ArrayList<>();
List<String> paths = srcStore.collectResourceRecursively(rootPath, MetadataConstants.FILE_SURFIX);
Map<String, String> tableMap = new HashMap<>();
for (String path : paths)
for (TableRef tableRef : tableRefs) {
String tableId = tableRef.getTableIdentity();
if (path.contains(tableId)) {
String prj = TableDesc.parseResourcePath(path).getSecond();
if (prj == null && tableMap.get(tableId) == null)
tableMap.put(tableRef.getTableIdentity(), path);
if (prj != null && prj.contains(project)) {
tableMap.put(tableRef.getTableIdentity(), path);
}
}
}
for (Map.Entry<String, String> e : tableMap.entrySet()) {
toResource.add(e.getValue());
}
return toResource;
}
代码示例来源:origin: KylinOLAP/Kylin
private List<String> listResourceStore(String pathRoot) {
List<String> paths = null;
try {
paths = store.collectResourceRecursively(pathRoot, MetadataConstants.FILE_SURFIX);
} catch (IOException e1) {
e1.printStackTrace();
errorMsgs.add("Get IOException when scan resource store at: " + ResourceStore.CUBE_DESC_RESOURCE_ROOT);
}
return paths;
}
代码示例来源:origin: KylinOLAP/Kylin
private void upgradeJobInstance() {
try {
List<String> paths = getStore().collectResourceRecursively(ResourceStore.JOB_PATH_ROOT, "");
for (String path : paths) {
upgradeJobInstance(path);
}
} catch (IOException ex) {
errorMsgs.add("upgrade job failed" + ex.getLocalizedMessage());
throw new RuntimeException(ex);
}
}
代码示例来源:origin: KylinOLAP/Kylin
private void loadAllIIInstance() throws IOException {
ResourceStore store = getStore();
List<String> paths = store.collectResourceRecursively(ResourceStore.II_RESOURCE_ROOT, ".json");
logger.debug("Loading II from folder " + store.getReadableResourcePath(ResourceStore.II_RESOURCE_ROOT));
for (String path : paths) {
loadIIInstance(path);
}
logger.debug("Loaded " + paths.size() + " II(s)");
}
代码示例来源:origin: KylinOLAP/Kylin
private void loadAllCubeInstance() throws IOException {
ResourceStore store = getStore();
List<String> paths = store.collectResourceRecursively(ResourceStore.CUBE_RESOURCE_ROOT, ".json");
logger.debug("Loading Cube from folder " + store.getReadableResourcePath(ResourceStore.CUBE_RESOURCE_ROOT));
for (String path : paths) {
loadCubeInstance(path);
}
logger.debug("Loaded " + paths.size() + " Cube(s)");
}
代码示例来源:origin: KylinOLAP/Kylin
private void reloadAllDataModel() throws IOException {
ResourceStore store = getStore();
logger.debug("Reloading DataModel from folder " + store.getReadableResourcePath(ResourceStore.DATA_MODEL_DESC_RESOURCE_ROOT));
dataModelDescMap.clear();
List<String> paths = store.collectResourceRecursively(ResourceStore.DATA_MODEL_DESC_RESOURCE_ROOT, MetadataConstants.FILE_SURFIX);
for (String path : paths) {
try {
reloadDataModelDescAt(path);
} catch (IllegalStateException e) {
logger.error("Error to load DataModel at " + path, e);
continue;
}
}
logger.debug("Loaded " + dataModelDescMap.size() + " DataModel(s)");
}
代码示例来源:origin: KylinOLAP/Kylin
private void reloadAllSourceTableExd() throws IOException {
ResourceStore store = getStore();
logger.debug("Reloading SourceTable exd info from folder " + store.getReadableResourcePath(ResourceStore.TABLE_EXD_RESOURCE_ROOT));
srcTableExdMap.clear();
List<String> paths = store.collectResourceRecursively(ResourceStore.TABLE_EXD_RESOURCE_ROOT, MetadataConstants.FILE_SURFIX);
for (String path : paths) {
reloadSourceTableExdAt(path);
}
logger.debug("Loaded " + srcTableExdMap.size() + " SourceTable EXD(s)");
}
代码示例来源:origin: KylinOLAP/Kylin
private void reloadAllSourceTable() throws IOException {
ResourceStore store = getStore();
logger.debug("Reloading SourceTable from folder " + store.getReadableResourcePath(ResourceStore.TABLE_RESOURCE_ROOT));
srcTableMap.clear();
List<String> paths = store.collectResourceRecursively(ResourceStore.TABLE_RESOURCE_ROOT, MetadataConstants.FILE_SURFIX);
for (String path : paths) {
reloadSourceTableAt(path);
}
logger.debug("Loaded " + srcTableMap.size() + " SourceTable(s)");
}
代码示例来源:origin: KylinOLAP/Kylin
private void reloadAllProjects() throws IOException {
ResourceStore store = getStore();
List<String> paths = store.collectResourceRecursively(ResourceStore.PROJECT_RESOURCE_ROOT, ".json");
logger.debug("Loading Project from folder " + store.getReadableResourcePath(ResourceStore.PROJECT_RESOURCE_ROOT));
for (String path : paths) {
reloadProjectAt(path);
}
wireProjectAndRealizations(projectMap.values());
logger.debug("Loaded " + projectMap.size() + " Project(s)");
}
代码示例来源:origin: KylinOLAP/Kylin
private void reloadAllIIDesc() throws IOException {
ResourceStore store = getStore();
logger.info("Reloading all II desc from folder " + store.getReadableResourcePath(ResourceStore.II_DESC_RESOURCE_ROOT));
iiDescMap.clear();
List<String> paths = store.collectResourceRecursively(ResourceStore.II_DESC_RESOURCE_ROOT, MetadataConstants.FILE_SURFIX);
for (String path : paths) {
logger.info("loading II Desc from path" + path);
IIDesc desc;
try {
desc = loadIIDesc(path);
} catch (Exception e) {
logger.error("Error loading II desc " + path, e);
continue;
}
if (!path.equals(desc.getResourcePath())) {
logger.error("Skip suspicious desc at " + path + ", " + desc + " should be at " + desc.getResourcePath());
continue;
}
if (iiDescMap.containsKey(desc.getName())) {
logger.error("Dup IIDesc name '" + desc.getName() + "' on path " + path);
continue;
}
iiDescMap.putLocal(desc.getName(), desc);
}
logger.debug("Loaded " + iiDescMap.size() + " II desc(s)");
}
代码示例来源:origin: KylinOLAP/Kylin
private void reloadAllCubeDesc() throws IOException {
ResourceStore store = getStore();
logger.info("Reloading Cube Metadata from folder " + store.getReadableResourcePath(ResourceStore.CUBE_DESC_RESOURCE_ROOT));
cubeDescMap.clear();
List<String> paths = store.collectResourceRecursively(ResourceStore.CUBE_DESC_RESOURCE_ROOT, MetadataConstants.FILE_SURFIX);
for (String path : paths) {
CubeDesc desc;
try {
desc = loadCubeDesc(path);
} catch (Exception e) {
logger.error("Error loading cube desc " + path, e);
continue;
}
if (path.equals(desc.getResourcePath()) == false) {
logger.error("Skip suspicious desc at " + path + ", " + desc + " should be at " + desc.getResourcePath());
continue;
}
if (cubeDescMap.containsKey(desc.getName())) {
logger.error("Dup CubeDesc name '" + desc.getName() + "' on path " + path);
continue;
}
cubeDescMap.putLocal(desc.getName(), desc);
}
logger.debug("Loaded " + cubeDescMap.size() + " Cube(s)");
}
代码示例来源:origin: org.apache.kylin/kylin-core-cube
protected List<String> listResourceStore(String pathRoot) {
List<String> paths = null;
try {
paths = store.collectResourceRecursively(pathRoot, MetadataConstants.FILE_SURFIX);
} catch (IOException e1) {
logger.error("error", e1);
errorMsgs.add("Get IOException when scan resource store at: " + ResourceStore.CUBE_DESC_RESOURCE_ROOT);
}
return paths;
}
代码示例来源:origin: org.apache.kylin/kylin-core-metadata
public void reloadAll() throws IOException {
logger.debug("Reloading " + entityType.getSimpleName() + " from " + store.getReadableResourcePath(resRootPath));
cache.clear();
List<String> paths = store.collectResourceRecursively(resRootPath, resPathSuffix);
for (String path : paths) {
reloadQuietlyAt(path);
}
logger.debug("Loaded " + cache.size() + " " + entityType.getSimpleName() + "(s) out of " + paths.size()
+ " resource");
}
代码示例来源:origin: org.apache.kylin/kylin-metadata
private void reloadAllSourceTable() throws IOException {
ResourceStore store = getStore();
logger.debug("Reloading SourceTable from folder " + store.getReadableResourcePath(ResourceStore.TABLE_RESOURCE_ROOT));
srcTableMap.clear();
List<String> paths = store.collectResourceRecursively(ResourceStore.TABLE_RESOURCE_ROOT, MetadataConstants.FILE_SURFIX);
for (String path : paths) {
reloadSourceTableAt(path);
}
logger.debug("Loaded " + srcTableMap.size() + " SourceTable(s)");
}
代码示例来源:origin: org.apache.kylin/kylin-metadata
private void reloadAllSourceTableExd() throws IOException {
ResourceStore store = getStore();
logger.debug("Reloading SourceTable exd info from folder " + store.getReadableResourcePath(ResourceStore.TABLE_EXD_RESOURCE_ROOT));
srcTableExdMap.clear();
List<String> paths = store.collectResourceRecursively(ResourceStore.TABLE_EXD_RESOURCE_ROOT, MetadataConstants.FILE_SURFIX);
for (String path : paths) {
reloadSourceTableExdAt(path);
}
logger.debug("Loaded " + srcTableExdMap.size() + " SourceTable EXD(s)");
}
代码示例来源:origin: org.apache.kylin/kylin-metadata
private void reloadAllProjects() throws IOException {
ResourceStore store = getStore();
List<String> paths = store.collectResourceRecursively(ResourceStore.PROJECT_RESOURCE_ROOT, ".json");
logger.debug("Loading Project from folder " + store.getReadableResourcePath(ResourceStore.PROJECT_RESOURCE_ROOT));
for (String path : paths) {
reloadProjectAt(path);
}
wireProjectAndRealizations(projectMap.values());
logger.debug("Loaded " + projectMap.size() + " Project(s)");
}
内容来源于网络,如有侵权,请联系作者删除!