本文整理了Java中org.apache.kylin.common.persistence.ResourceStore.listResources
方法的一些代码示例,展示了ResourceStore.listResources
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ResourceStore.listResources
方法的具体详情如下:
包路径:org.apache.kylin.common.persistence.ResourceStore
类名称:ResourceStore
方法名:listResources
[英]return a list of child resources & folders under given path, return null if given path is not a folder
[中]返回给定路径下的子资源和文件夹列表,如果给定路径不是文件夹,则返回null
代码示例来源:origin: apache/kylin
public NavigableSet<String> list(KylinConfig config, String path) throws IOException {
ResourceStore store = ResourceStore.getStore(config);
NavigableSet<String> result = store.listResources(path);
System.out.println("" + result);
return result;
}
代码示例来源:origin: apache/kylin
public static void collectFiles(ResourceStore src, String path, List<String> ret) throws IOException {
NavigableSet<String> children = src.listResources(path);
if (children == null) {
// case of resource (not a folder)
ret.add(path);
} else {
// case of folder
for (String child : children) {
collectFiles(src, child, ret);
}
}
}
}
代码示例来源:origin: apache/kylin
public Set<String> getAllExtSnapshotResPaths() throws IOException {
Set<String> result = Sets.newHashSet();
ResourceStore store = TableMetadataManager.getInstance(this.config).getStore();
Set<String> snapshotTablePaths = store.listResources(ResourceStore.EXT_SNAPSHOT_RESOURCE_ROOT);
if (snapshotTablePaths == null) {
return result;
}
for (String snapshotTablePath : snapshotTablePaths) {
Set<String> snapshotPaths = store.listResources(snapshotTablePath);
if (snapshotPaths != null) {
result.addAll(snapshotPaths);
}
}
return result;
}
代码示例来源:origin: apache/kylin
public List<String> getJobIds() throws PersistentException {
try {
NavigableSet<String> resources = store.listResources(ResourceStore.EXECUTE_RESOURCE_ROOT);
if (resources == null) {
return Collections.emptyList();
}
ArrayList<String> result = Lists.newArrayListWithExpectedSize(resources.size());
for (String path : resources) {
result.add(path.substring(path.lastIndexOf("/") + 1));
}
return result;
} catch (IOException e) {
logger.error("error get all Jobs:", e);
throw new PersistentException(e);
}
}
代码示例来源:origin: apache/kylin
public List<Draft> list(String project) throws IOException {
List<Draft> result = new ArrayList<>();
ResourceStore store = getStore();
NavigableSet<String> listPath = store.listResources(ResourceStore.DRAFT_RESOURCE_ROOT);
if (listPath == null)
return result;
for (String path : listPath) {
Draft draft = store.getResource(path, DRAFT_SERIALIZER);
if (draft == null)
continue;
if (project == null || project.equals(draft.getProject()))
result.add(draft);
}
return result;
}
代码示例来源:origin: apache/kylin
@Override
public void reloadAll() throws IOException {
logger.debug("Reloading execute_output from " + ResourceStore.EXECUTE_OUTPUT_RESOURCE_ROOT);
executableOutputDigestMap.clear();
NavigableSet<String> paths = store.listResources(ResourceStore.EXECUTE_OUTPUT_RESOURCE_ROOT);
if (paths != null) {
for (String path : paths) {
if (!isTaskExecutableOutput(resourceName(path)))
reloadAt(path);
}
logger.debug("Loaded {} execute_output digest(s) out of {} resource",
executableOutputDigestMap.size(), paths.size());
}
}
代码示例来源:origin: apache/kylin
public void resetR(ResourceStore store, String path) throws IOException {
NavigableSet<String> children = store.listResources(path);
if (children == null) { // path is a resource (not a folder)
if (matchFilter(path, includes, excludes)) {
store.deleteResource(path);
}
} else {
for (String child : children)
resetR(store, child);
}
}
代码示例来源:origin: apache/kylin
private String checkDupByContent(DictionaryInfo dictInfo, Dictionary<String> dict) throws IOException {
ResourceStore store = getStore();
NavigableSet<String> existings = store.listResources(dictInfo.getResourceDir());
if (existings == null)
return null;
logger.info("{} existing dictionaries of the same column", existings.size());
if (existings.size() > 100) {
logger.warn("Too many dictionaries under {}, dict count: {}", dictInfo.getResourceDir(), existings.size());
}
for (String existing : existings) {
DictionaryInfo existingInfo = getDictionaryInfo(existing);
if (existingInfo != null) {
if ((config.isDictResuable() && existingInfo.getDictionaryObject().contains(dict))
|| dict.equals(existingInfo.getDictionaryObject())) {
return existing;
}
}
}
return null;
}
代码示例来源:origin: apache/kylin
children = src.listResources(path);
代码示例来源:origin: apache/kylin
private String checkDupByContent(SnapshotTable snapshot) throws IOException {
ResourceStore store = getStore();
String resourceDir = snapshot.getResourceDir();
NavigableSet<String> existings = store.listResources(resourceDir);
if (existings == null)
return null;
for (String existing : existings) {
SnapshotTable existingTable = load(existing, true); // skip cache, direct load from store
if (existingTable != null && existingTable.equals(snapshot))
return existing;
}
return null;
}
代码示例来源:origin: apache/kylin
public void removeDictionaries(String srcTable, String srcCol) throws IOException {
DictionaryInfo info = new DictionaryInfo();
info.setSourceTable(srcTable);
info.setSourceColumn(srcCol);
ResourceStore store = getStore();
NavigableSet<String> existings = store.listResources(info.getResourceDir());
if (existings == null)
return;
for (String existing : existings)
removeDictionary(existing);
}
代码示例来源:origin: apache/kylin
@Test
public void testCopy() throws IOException {
KylinConfig dstConfig = KylinConfig.createInstanceFromUri(dstPath);
ResourceStore srcStore = ResourceStore.getStore(KylinConfig.getInstanceFromEnv());
ResourceStore dstStore = ResourceStore.getStore(dstConfig);
//metadata under source path and destination path are not equal before copy
Assert.assertNotEquals(srcStore.listResources("/"), dstStore.listResources("/"));
new ResourceTool().copy(KylinConfig.getInstanceFromEnv(), dstConfig, "/");
//After copy, two paths have same metadata
Assert.assertEquals(srcStore.listResources("/"), dstStore.listResources("/"));
}
}
代码示例来源:origin: apache/kylin
for (String dir : noNull(store.listResources(resourceRoot))) {
for (String res : noNull(store.listResources(dir))) {
if (store.getResourceTimestamp(res) < newResourceTimeCut)
toDeleteCandidates.add(res);
for (String dir : noNull(store.listResources(resourceRoot))) {
for (String dir2 : noNull(store.listResources(dir))) {
for (String res : noNull(store.listResources(dir2))) {
if (store.getResourceTimestamp(res) < newResourceTimeCut)
toDeleteCandidates.add(res);
代码示例来源:origin: apache/kylin
NavigableSet<String> snapshotTables = getStore().listResources(resourceRoot);
NavigableSet<String> snapshotNames = getStore().listResources(snapshotTable);
if (snapshotNames != null)
for (String snapshot : snapshotNames) {
NavigableSet<String> dictTables = getStore().listResources(ResourceStore.DICT_RESOURCE_ROOT);
NavigableSet<String> tableColNames = getStore().listResources(table);
if (tableColNames != null)
for (String tableCol : tableColNames) {
NavigableSet<String> dictionaries = getStore().listResources(tableCol);
if (dictionaries != null)
for (String dict : dictionaries)
代码示例来源:origin: apache/kylin
private String checkDupByInfo(SnapshotTable snapshot) throws IOException {
ResourceStore store = getStore();
String resourceDir = snapshot.getResourceDir();
NavigableSet<String> existings = store.listResources(resourceDir);
if (existings == null)
return null;
TableSignature sig = snapshot.getSignature();
for (String existing : existings) {
SnapshotTable existingTable = load(existing, false); // skip cache,
// direct load from store
if (existingTable != null && sig.equals(existingTable.getSignature()))
return existing;
}
return null;
}
代码示例来源:origin: apache/kylin
@Test
public void testGetAllCubes() throws Exception {
final ResourceStore store = ResourceStore.getStore(getTestConfig());
final NavigableSet<String> cubePath = store.listResources(ResourceStore.CUBE_RESOURCE_ROOT);
assertTrue(cubePath.size() > 1);
final List<CubeInstance> cubes = store.getAllResources(ResourceStore.CUBE_RESOURCE_ROOT,
CubeManager.CUBE_SERIALIZER);
assertEquals(cubePath.size(), cubes.size());
}
代码示例来源:origin: apache/kylin
private ExtTableSnapshotInfo checkDupByInfo(ExtTableSnapshotInfo snapshot) throws IOException {
ResourceStore store = TableMetadataManager.getInstance(this.config).getStore();
String resourceDir = snapshot.getResourceDir();
NavigableSet<String> existings = store.listResources(resourceDir);
if (existings == null)
return null;
TableSignature sig = snapshot.getSignature();
for (String existing : existings) {
ExtTableSnapshotInfo existingSnapshot = load(existing);
// direct load from store
if (existingSnapshot != null && sig.equals(existingSnapshot.getSignature()))
return existingSnapshot;
}
return null;
}
代码示例来源:origin: KylinOLAP/Kylin
public static void list(KylinConfig config, String path) throws IOException {
ResourceStore store = ResourceStore.getStore(config);
ArrayList<String> result = store.listResources(path);
System.out.println("" + result);
}
代码示例来源:origin: apache/kylin
list = store.listResources(dir1);
System.out.println(list);
assertTrue(list.contains(path1));
assertTrue(list.contains(path2) == false);
list = store.listResources(dir2);
assertTrue(list.contains(path2));
assertTrue(list.contains(path1) == false);
list = store.listResources("/");
assertTrue(list.contains(dir1));
assertTrue(list.contains(dir2));
assertTrue(list.contains(path2) == false);
list = store.listResources(path1);
assertNull(list);
list = store.listResources(path2);
assertNull(list);
list = store.listResources(dir1);
assertTrue(list == null || list.contains(path1) == false);
list = store.listResources(dir2);
assertTrue(list == null || list.contains(path2) == false);
代码示例来源:origin: KylinOLAP/Kylin
public void removeDictionaries(String srcTable, String srcCol) throws IOException {
DictionaryInfo info = new DictionaryInfo();
info.setSourceTable(srcTable);
info.setSourceColumn(srcCol);
ResourceStore store = MetadataManager.getInstance(config).getStore();
ArrayList<String> existings = store.listResources(info.getResourceDir());
if (existings == null)
return;
for (String existing : existings)
removeDictionary(existing);
}
内容来源于网络,如有侵权,请联系作者删除!