本文整理汇总了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;
}
示例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;
}