org.apache.kylin.common.persistence.ResourceStore.norm()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(67)

本文整理了Java中org.apache.kylin.common.persistence.ResourceStore.norm方法的一些代码示例,展示了ResourceStore.norm的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ResourceStore.norm方法的具体详情如下:
包路径:org.apache.kylin.common.persistence.ResourceStore
类名称:ResourceStore
方法名:norm

ResourceStore.norm介绍

暂无

代码示例

代码示例来源: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

/**
 * List resources recursively under a folder, return null if folder does not exist or is empty
 */
final public NavigableSet<String> listResourcesRecursively(String folderPath) throws IOException {
  return listResourcesRecursivelyImpl(norm(folderPath));
}

代码示例来源:origin: apache/kylin

/**
 * get a readable string of a resource path
 */
final public String getReadableResourcePath(String resPath) {
  return getReadableResourcePathImpl(norm(resPath));
}

代码示例来源:origin: apache/kylin

/**
 * List resources and sub-folders under a given folder, return null if folder does not exist or is empty
 */
final public NavigableSet<String> listResources(String folderPath) throws IOException {
  return listResourcesImpl(norm(folderPath));
}

代码示例来源:origin: apache/kylin

/**
 * Caution: Caller must close the returned RawResource.
 */
final public RawResource getResource(String resPath) throws IOException {
  return getResourceWithRetry(norm(resPath));
}

代码示例来源:origin: apache/kylin

/**
 * Check & set, overwrite a resource.
 *
 * @return a confirmed TS, as some store may lose timestamp precision.
 */
final public long checkAndPutResource(String resPath, byte[] content, long oldTS, long newTS)
    throws IOException, WriteConflictException {
  return checkAndPutResourceCheckpoint(norm(resPath), content, oldTS, newTS);
}

代码示例来源:origin: apache/kylin

/**
 * Return true if a resource exists, return false in case of folder or non-exist
 */
final public boolean exists(String resPath) throws IOException {
  return existsImpl(norm(resPath));
}

代码示例来源:origin: apache/kylin

final public long getResourceTimestamp(String resPath) throws IOException {
  return getResourceTimestampWithRetry(norm(resPath));
}

代码示例来源:origin: apache/kylin

/**
 * delete a resource, does nothing on a folder
 */
final public void deleteResource(String resPath) throws IOException {
  logger.trace("Deleting resource " + resPath + " (Store " + kylinConfig.getMetadataUrl() + ")");
  deleteResourceCheckpoint(norm(resPath));
}

代码示例来源:origin: apache/kylin

private void visitFolderInner(String folderPath, boolean recursive, VisitFilter filter, boolean loadContent, Visitor visitor) throws IOException {
  if (filter == null)
    filter = new VisitFilter();
  folderPath = norm(folderPath);
  if (filter.hasPathPrefixFilter()) {
    String folderPrefix = folderPath.endsWith("/") ? folderPath : folderPath + "/";
    Preconditions.checkArgument(filter.pathPrefix.startsWith(folderPrefix));
  }
  visitFolderImpl(folderPath, recursive, filter, loadContent, visitor);
}

代码示例来源:origin: apache/kylin

final public long getResourceTimestampWithRetry(String resPath) throws IOException {
  final String path = norm(resPath);
  ExponentialBackoffRetry retry = new ExponentialBackoffRetry(this);
  return retry.doWithRetry(new Callable<Long>() {
    @Override
    public Long call() throws IOException {
      return getResourceTimestampImpl(path);
    }
  });
}

代码示例来源:origin: apache/kylin

/**
 * Read a resource, return null in case of not found or is a folder.
 */
final public <T extends RootPersistentEntity> T getResource(String resPath, ContentReader<T> reader)
    throws IOException {
  resPath = norm(resPath);
  RawResource res = getResourceWithRetry(resPath);
  if (res == null)
    return null;
  return reader.readContent(res);
}

代码示例来源:origin: apache/kylin

/**
 * Overwrite a resource without write conflict check
 * @return bytes written
 */
final public long putResource(String resPath, InputStream content, long ts) throws IOException {
  resPath = norm(resPath);
  ContentWriter writer = ContentWriter.create(content);
  putResourceCheckpoint(resPath, writer, ts);
  return writer.bytesWritten();
}

代码示例来源:origin: apache/kylin

/**
 * check & set, overwrite a resource
 */
final public <T extends RootPersistentEntity> void checkAndPutResource(String resPath, T obj, long newTS,
                                    Serializer<T> serializer) throws IOException, WriteConflictException {
  resPath = norm(resPath);
  //logger.debug("Saving resource " + resPath + " (Store " + kylinConfig.getMetadataUrl() + ")");
  long oldTS = obj.getLastModified();
  obj.setLastModified(newTS);
  try {
    ByteArrayOutputStream buf = new ByteArrayOutputStream();
    DataOutputStream dout = new DataOutputStream(buf);
    serializer.serialize(obj, dout);
    dout.close();
    buf.close();
    long confirmedTS = checkAndPutResource(resPath, buf.toByteArray(), oldTS, newTS);
    obj.setLastModified(confirmedTS); // update again the confirmed TS
    //return confirmedTS;
  } catch (IOException e) {
    obj.setLastModified(oldTS); // roll back TS when write fail
    throw e;
  } catch (RuntimeException e) {
    obj.setLastModified(oldTS); // roll back TS when write fail
    throw e;
  }
}

代码示例来源:origin: apache/kylin

/**
 * Overwrite a resource without write conflict check
 * @return bytes written
 */
final public <T extends RootPersistentEntity> long putResource(String resPath, T obj, long ts,
                                Serializer<T> serializer) throws IOException {
  resPath = norm(resPath);
  obj.setLastModified(ts);
  ContentWriter writer = ContentWriter.create(obj, serializer);
  putResourceCheckpoint(resPath, writer, ts);
  return writer.bytesWritten();
}

代码示例来源:origin: apache/kylin

/**
 * Overwrite a resource without write conflict check
 * @return bytes written
 */
final public <T extends RootPersistentEntity> long putBigResource(String resPath, T obj, long ts,
    Serializer<T> serializer) throws IOException {
  resPath = norm(resPath);
  obj.setLastModified(ts);
  ContentWriter writer = ContentWriter.create(obj, serializer);
  writer.markBigContent();
  putResourceCheckpoint(resPath, writer, ts);
  return writer.bytesWritten();
}

代码示例来源:origin: KylinOLAP/Kylin

/**
 * return true if a resource exists, return false in case of folder or
 * non-exist
 */
final public boolean exists(String resPath) throws IOException {
  return existsImpl(norm(resPath));
}

代码示例来源:origin: KylinOLAP/Kylin

/**
 * get a readable string of a resource path
 */
final public String getReadableResourcePath(String resPath) {
  return getReadableResourcePathImpl(norm(resPath));
}

代码示例来源:origin: KylinOLAP/Kylin

/**
 * overwrite a resource without write conflict check
 */
final public void putResource(String resPath, InputStream content, long ts) throws IOException {
  resPath = norm(resPath);
  logger.debug("Saving resource " + resPath + " (Store " + kylinConfig.getMetadataUrl() + ")");
  putResourceImpl(resPath, content, ts);
}

代码示例来源:origin: KylinOLAP/Kylin

/**
 * delete a resource, does nothing on a folder
 */
final public void deleteResource(String resPath) throws IOException {
  logger.debug("Deleting resource " + resPath + " (Store " + kylinConfig.getMetadataUrl() + ")");
  deleteResourceImpl(norm(resPath));
}

相关文章