• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java StorageObjectsChunk类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.jets3t.service.StorageObjectsChunk的典型用法代码示例。如果您正苦于以下问题:Java StorageObjectsChunk类的具体用法?Java StorageObjectsChunk怎么用?Java StorageObjectsChunk使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



StorageObjectsChunk类属于org.jets3t.service包,在下文中一共展示了StorageObjectsChunk类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: list

import org.jets3t.service.StorageObjectsChunk; //导入依赖的package包/类
/**
 * list objects
 * @param prefix prefix
 * @param delimiter delimiter
 * @param maxListingLength max no. of entries
 * @param priorLastKey last key in any previous search
 * @return a list of matches
 * @throws IOException on any reported failure
 */

private PartialListing list(String prefix, String delimiter,
    int maxListingLength, String priorLastKey) throws IOException {
  try {
    if (!prefix.isEmpty() && !prefix.endsWith(PATH_DELIMITER)) {
      prefix += PATH_DELIMITER;
    }
    StorageObjectsChunk chunk = s3Service.listObjectsChunked(bucket.getName(),
        prefix, delimiter, maxListingLength, priorLastKey);
    
    FileMetadata[] fileMetadata =
      new FileMetadata[chunk.getObjects().length];
    for (int i = 0; i < fileMetadata.length; i++) {
      StorageObject object = chunk.getObjects()[i];
      fileMetadata[i] = new FileMetadata(object.getKey(),
          object.getContentLength(), object.getLastModifiedDate().getTime());
    }
    return new PartialListing(chunk.getPriorLastKey(), fileMetadata,
        chunk.getCommonPrefixes());
  } catch (ServiceException e) {
    handleException(e, prefix);
    return null; // never returned - keep compiler happy
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:34,代码来源:Jets3tNativeFileSystemStore.java


示例2: run

import org.jets3t.service.StorageObjectsChunk; //导入依赖的package包/类
public void run() {
    try {
        List allObjects = new ArrayList();
        List allCommonPrefixes = new ArrayList();

        do {
            StorageObjectsChunk chunk = storageService.listObjectsChunked(
                bucketName, prefix, delimiter, maxListingLength, priorLastKey);
            priorLastKey = chunk.getPriorLastKey();

            allObjects.addAll(Arrays.asList(chunk.getObjects()));
            allCommonPrefixes.addAll(Arrays.asList(chunk.getCommonPrefixes()));
        } while (!halted && priorLastKey != null);

        result = new StorageObjectsChunk(
            prefix, delimiter,
            (StorageObject[]) allObjects.toArray(new StorageObject[allObjects.size()]),
            (String[]) allCommonPrefixes.toArray(new String[allCommonPrefixes.size()]),
            null);
    } catch (ServiceException e) {
        result = e;
    }
}
 
开发者ID:guptavishal,项目名称:jets3t-aws-roles,代码行数:24,代码来源:ThreadedStorageService.java


示例3: listAll

import org.jets3t.service.StorageObjectsChunk; //导入依赖的package包/类
public List<ListItem> listAll(String path) {
    m_logger.debug("Start list all: " + path);
    try {
        List<ListItem> result = new ArrayList<>();
        String priorLastKey = null;
        while(true) {
            StorageObjectsChunk chunk = m_s3service.listObjectsChunked(BUCKET, path, "/", CHUNK_SIZE, priorLastKey);
            m_logger.trace("ListObjects: {}", path);
            inc();
            StorageObject[] objects = chunk.getObjects();
            for(int i = 0; i < objects.length; i++) {
                String key = objects[i].getKey();
                if(key.endsWith("/")) key = key.substring(0, key.length() - 1);
                key = key.substring(path.length(), key.length());
                ListItem item = new ListItem(key, objects[i].getContentLength() != 0);
                result.add(item);
            }
            if(chunk.isListingComplete()) break;
            priorLastKey = chunk.getPriorLastKey();
        }
        return result;
   } catch (ServiceException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:QSFT,项目名称:Doradus,代码行数:26,代码来源:AmazonConnection.java


示例4: deleteAll

import org.jets3t.service.StorageObjectsChunk; //导入依赖的package包/类
public void deleteAll(String path) {
    try {
        String priorLastKey = null;
        while(true) {
            StorageObjectsChunk chunk = m_s3service.listObjectsChunked(BUCKET, path, "?", CHUNK_SIZE, priorLastKey);
            m_logger.trace("ListObjects to delete: {}", path);
            inc();
            StorageObject[] objects = chunk.getObjects();
            if(objects.length == 0) break;
            String[] names = new String[objects.length];
            for(int i = 0; i < objects.length; i++) {
                names[i] = objects[i].getKey();
            }
            m_s3service.deleteMultipleObjects(BUCKET, names);
            m_logger.trace("DeleteObjects: {}", objects.length);
            // do not inc() because delete requests are not counted
            
            if(chunk.isListingComplete()) break;
            priorLastKey = chunk.getPriorLastKey();
        }
    } catch (ServiceException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:QSFT,项目名称:Doradus,代码行数:25,代码来源:AmazonConnection.java


示例5: listObjectsChunkedImpl

import org.jets3t.service.StorageObjectsChunk; //导入依赖的package包/类
@Override
protected StorageObjectsChunk listObjectsChunkedImpl(String bucketName, String prefix, String delimiter,
    long maxListingLength, String priorLastKey, boolean completeListing) throws ServiceException
{
    return listObjectsInternal(bucketName, prefix, delimiter,
        maxListingLength, completeListing, priorLastKey, null);
}
 
开发者ID:guptavishal,项目名称:jets3t-aws-roles,代码行数:8,代码来源:RestStorageService.java


示例6: newInProgressEvent

import org.jets3t.service.StorageObjectsChunk; //导入依赖的package包/类
public static ListObjectsEvent newInProgressEvent(ThreadWatcher threadWatcher,
    List<StorageObjectsChunk> chunkList, Object uniqueOperationId)
{
    ListObjectsEvent event = new ListObjectsEvent(EVENT_IN_PROGRESS, uniqueOperationId);
    event.setThreadWatcher(threadWatcher);
    event.setChunkList(chunkList);
    return event;
}
 
开发者ID:guptavishal,项目名称:jets3t-aws-roles,代码行数:9,代码来源:ListObjectsEvent.java


示例7: buildObjectMapPartial

import org.jets3t.service.StorageObjectsChunk; //导入依赖的package包/类
/**
 * Builds a service Object Map containing a partial set of objects within the given target path,
 * where the map's key for each object is the relative path to the object.
 * <p>
 * If the method is asked to perform a complete listing, it will use the
 * {@link #listObjectsThreaded(StorageService, String, String)} method to list the objects
 * in the bucket, potentially taking advantage of any bucket name partitioning
 * settings you have applied.
 * <p>
 * If the method is asked to perform only a partial listing, no bucket name
 * partitioning will be applied.
 *
 * @see #lookupObjectMetadataForPotentialClashes(StorageService, String, String, StorageObject[], Map, boolean, boolean, BytesProgressWatcher, StorageServiceEventListener)
 *
 * @param service
 * @param bucketName
 * @param targetPath
 * @param priorLastKey
 * the prior last key value returned by a prior invocation of this method, if any.
 * @param objectKeyToFilepathMap
 * map of '/'-delimited object key names to local file absolute paths
 * @param forceMetadataDownload
 * if true, metadata is always downloaded for objects in the storage service. If false,
 * metadata is only downloaded if deemed necessary. This flag should be set to true when
 * data for any objects in the storage service has been transformed, such as by
 * encryption or compression during upload.
 * @param isForceUpload
 * set to true if the calling tool will upload files regardless of the comparison, so this
 * method will avoid any unnecessary and potentially expensive data/date comparison checks.
 * @param completeListing
 * if true, this method will perform a complete listing of a service target.
 * If false, the method will list a partial set of objects commencing from the
 * given prior last key.
 * @param progressWatcher
 * watcher to monitor bytes read during comparison operations, may be null.
 * @param eventListener
 *
 * @return
 * an object containing a mapping of key names to StorageObjects, and the prior last
 * key (if any) that should be used to perform follow-up method calls.
 * @throws ServiceException
 */
public PartialObjectListing buildObjectMapPartial(StorageService service,
    String bucketName, String targetPath, String priorLastKey,
    Map<String, String> objectKeyToFilepathMap, boolean completeListing,
    boolean forceMetadataDownload, boolean isForceUpload,
    BytesProgressWatcher progressWatcher, StorageServiceEventListener eventListener)
    throws ServiceException
{
    String prefix = (targetPath.length() > 0 ? targetPath : null);
    StorageObject[] objects = null;
    String resultPriorLastKey = null;
    if (completeListing) {
        objects = listObjectsThreaded(service, bucketName, prefix);
    } else {
        StorageObjectsChunk chunk = service.listObjectsChunked(
            bucketName, prefix, null, Constants.DEFAULT_OBJECT_LIST_CHUNK_SIZE,
            priorLastKey, completeListing);
        objects = chunk.getObjects();
        resultPriorLastKey = chunk.getPriorLastKey();
    }

    Map<String, StorageObject> objectsMap = lookupObjectMetadataForPotentialClashes(
        service, bucketName, targetPath, objects, objectKeyToFilepathMap,
        forceMetadataDownload, isForceUpload, progressWatcher, eventListener);
    return new PartialObjectListing(objectsMap, resultPriorLastKey);
}
 
开发者ID:guptavishal,项目名称:jets3t-aws-roles,代码行数:68,代码来源:FileComparer.java


示例8: setChunkList

import org.jets3t.service.StorageObjectsChunk; //导入依赖的package包/类
private void setChunkList(List<StorageObjectsChunk> chunkList) {
    this.chunkList = chunkList;
}
 
开发者ID:guptavishal,项目名称:jets3t-aws-roles,代码行数:4,代码来源:ListObjectsEvent.java


示例9: getChunkList

import org.jets3t.service.StorageObjectsChunk; //导入依赖的package包/类
/**
 * @return
 * a list of the {@link StorageObjectsChunk}s that have been generated since the
 * last progress event was fired.
 * @throws IllegalStateException
 * listed objects are only available from EVENT_IN_PROGRESS events.
 */
public List<StorageObjectsChunk> getChunkList() throws IllegalStateException {
    if (getEventCode() != EVENT_IN_PROGRESS) {
        throw new IllegalStateException("Chunk list is only available from EVENT_IN_PROGRESS events");
    }
    return this.chunkList;
}
 
开发者ID:guptavishal,项目名称:jets3t-aws-roles,代码行数:14,代码来源:ListObjectsEvent.java



注:本文中的org.jets3t.service.StorageObjectsChunk类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Headers类代码示例发布时间:2022-05-22
下一篇:
Java VarType类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap