當前位置: 首頁>>代碼示例>>Java>>正文


Java ListObjectsRequest.getBucketName方法代碼示例

本文整理匯總了Java中com.amazonaws.services.s3.model.ListObjectsRequest.getBucketName方法的典型用法代碼示例。如果您正苦於以下問題:Java ListObjectsRequest.getBucketName方法的具體用法?Java ListObjectsRequest.getBucketName怎麽用?Java ListObjectsRequest.getBucketName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.amazonaws.services.s3.model.ListObjectsRequest的用法示例。


在下文中一共展示了ListObjectsRequest.getBucketName方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: listObjects

import com.amazonaws.services.s3.model.ListObjectsRequest; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 * <p/>
 * If the bucket does not exist, returns a listing with an empty list. If a prefix is specified in listObjectsRequest, only keys starting with the prefix
 * will be returned.
 */
@Override
public ObjectListing listObjects(ListObjectsRequest listObjectsRequest, AmazonS3 s3Client)
{
    LOGGER.debug("listObjects(): listObjectsRequest.getBucketName() = " + listObjectsRequest.getBucketName());

    String bucketName = listObjectsRequest.getBucketName();

    if (MOCK_S3_BUCKET_NAME_NO_SUCH_BUCKET_EXCEPTION.equals(bucketName))
    {
        AmazonS3Exception amazonS3Exception = new AmazonS3Exception(MOCK_S3_BUCKET_NAME_NO_SUCH_BUCKET_EXCEPTION);
        amazonS3Exception.setErrorCode("NoSuchBucket");
        throw amazonS3Exception;
    }

    ObjectListing objectListing = new ObjectListing();
    objectListing.setBucketName(bucketName);

    MockS3Bucket mockS3Bucket = mockS3Buckets.get(bucketName);
    if (mockS3Bucket != null)
    {
        for (MockS3Object mockS3Object : mockS3Bucket.getObjects().values())
        {
            String s3ObjectKey = mockS3Object.getKey();
            if (listObjectsRequest.getPrefix() == null || s3ObjectKey.startsWith(listObjectsRequest.getPrefix()))
            {
                S3ObjectSummary s3ObjectSummary = new S3ObjectSummary();
                s3ObjectSummary.setBucketName(bucketName);
                s3ObjectSummary.setKey(s3ObjectKey);
                s3ObjectSummary.setSize(mockS3Object.getData().length);
                s3ObjectSummary.setStorageClass(mockS3Object.getObjectMetadata() != null ? mockS3Object.getObjectMetadata().getStorageClass() : null);

                objectListing.getObjectSummaries().add(s3ObjectSummary);
            }
        }
    }

    return objectListing;
}
 
開發者ID:FINRAOS,項目名稱:herd,代碼行數:45,代碼來源:MockS3OperationsImpl.java

示例2: matches

import com.amazonaws.services.s3.model.ListObjectsRequest; //導入方法依賴的package包/類
@Override
     public boolean matches(ListObjectsRequest listObjectsRequest) {
if (listObjectsRequest == null) {
	return false;
}
boolean bucketNameIsEqual;
if (listObjectsRequest.getBucketName() != null) {
	bucketNameIsEqual = listObjectsRequest.getBucketName().equals(this.bucketName);
} else {
	bucketNameIsEqual = this.bucketName == null;
}

boolean prefixIsEqual;
if (listObjectsRequest.getPrefix() != null) {
	prefixIsEqual = listObjectsRequest.getPrefix().equals(this.prefix);
} else {
	prefixIsEqual = this.prefix == null;
}

boolean delimiterIsEqual;
if (listObjectsRequest.getDelimiter() != null) {
	delimiterIsEqual = listObjectsRequest.getDelimiter().equals(this.delimiter);
} else {
	delimiterIsEqual = this.delimiter == null;
}


return delimiterIsEqual && prefixIsEqual && bucketNameIsEqual;
     }
 
開發者ID:spring-cloud,項目名稱:spring-cloud-aws,代碼行數:30,代碼來源:PathMatchingSimpleStorageResourcePatternResolverTest.java

示例3: matches

import com.amazonaws.services.s3.model.ListObjectsRequest; //導入方法依賴的package包/類
@Override
public boolean matches(Object obj) {
    if (this.listObjectsRequest == obj) {
        return true;
    }
    if (obj == null) {
        return false;
    }
    if (ListObjectsRequest.class != obj.getClass()) {
        return false;
    }
    ListObjectsRequest other = (ListObjectsRequest) obj;
    if (this.listObjectsRequest.getBucketName() == null) {
        if (other.getBucketName() != null) {
            return false;
        }
    } else if (!this.listObjectsRequest.getBucketName().equals(other.getBucketName())) {
        return false;
    }
    if (this.listObjectsRequest.getPrefix() == null) {
        if (other.getPrefix() != null) {
            return false;
        }
    } else if (!this.listObjectsRequest.getPrefix().equals(other.getPrefix())) {
        return false;
    }
    if (this.listObjectsRequest.getDelimiter() == null) {
        if (other.getDelimiter() != null) {
            return false;
        }
    } else if (!this.listObjectsRequest.getDelimiter().equals(other.getDelimiter())) {
        return false;
    }
    if (this.listObjectsRequest.getMarker() == null) {
        if (other.getMarker() != null) {
            return false;
        }
    } else if (!this.listObjectsRequest.getMarker().equals(other.getMarker())) {
        return false;
    }
    if (this.listObjectsRequest.getMaxKeys() == null) {
        if (other.getMaxKeys() != null) {
            return false;
        }
    } else if (!this.listObjectsRequest.getMaxKeys().equals(other.getMaxKeys())) {
        return false;
    }
    return true;
}
 
開發者ID:lambadaframework,項目名稱:lambadaframework,代碼行數:50,代碼來源:ListObjectsRequestMatcher.java


注:本文中的com.amazonaws.services.s3.model.ListObjectsRequest.getBucketName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。