当前位置: 首页>>代码示例>>Java>>正文


Java StorageObjectsChunk.getObjects方法代码示例

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


在下文中一共展示了StorageObjectsChunk.getObjects方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例3: 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

示例4: 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


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