本文整理匯總了Java中org.jets3t.service.model.S3BucketVersioningStatus類的典型用法代碼示例。如果您正苦於以下問題:Java S3BucketVersioningStatus類的具體用法?Java S3BucketVersioningStatus怎麽用?Java S3BucketVersioningStatus使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
S3BucketVersioningStatus類屬於org.jets3t.service.model包,在下文中一共展示了S3BucketVersioningStatus類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getBucketVersioningStatusImpl
import org.jets3t.service.model.S3BucketVersioningStatus; //導入依賴的package包/類
@Override
protected S3BucketVersioningStatus getBucketVersioningStatusImpl(String bucketName)
throws S3ServiceException
{
try {
if (log.isDebugEnabled()) {
log.debug( "Checking status of versioning for bucket " + bucketName);
}
Map<String, String> requestParams = new HashMap<String, String>();
requestParams.put("versioning", null);
HttpResponse response = performRestGet(bucketName, null, requestParams, null);
return getXmlResponseSaxParser()
.parseVersioningConfigurationResponse(new HttpMethodReleaseInputStream(response));
} catch (ServiceException se) {
throw new S3ServiceException(se);
}
}
示例2: testEnableVersioning
import org.jets3t.service.model.S3BucketVersioningStatus; //導入依賴的package包/類
@Test
public void testEnableVersioning() throws IOException, ServiceException {
S3HdfsPath s3HdfsPath1 = testUtil.setUpS3HdfsPath("versionedBucket");
// Enable versioning
S3Bucket retBucket =
s3Service.createBucket(new S3Bucket(s3HdfsPath1.getBucketName()));
s3Service.enableBucketVersioning(retBucket.getName());
// Check versioning is enabled
S3BucketVersioningStatus bucketVersioningStatus =
s3Service.getBucketVersioningStatus(retBucket.getName());
assertEquals(true, bucketVersioningStatus.isVersioningEnabled());
s3Service.suspendBucketVersioning(retBucket.getName());
// Check versioning is disabled
bucketVersioningStatus =
s3Service.getBucketVersioningStatus(retBucket.getName());
assertEquals(false, bucketVersioningStatus.isVersioningEnabled());
}
示例3: getConfiguration
import org.jets3t.service.model.S3BucketVersioningStatus; //導入依賴的package包/類
@Override
public VersioningConfiguration getConfiguration(final Path file) throws BackgroundException {
final Path container = containerService.getContainer(file);
if(container.isRoot()) {
return VersioningConfiguration.empty();
}
if(cache.containsKey(container)) {
return cache.get(container);
}
try {
final S3BucketVersioningStatus status
= session.getClient().getBucketVersioningStatus(container.getName());
final VersioningConfiguration configuration = new VersioningConfiguration(status.isVersioningEnabled(),
status.isMultiFactorAuthDeleteRequired());
cache.put(container, configuration);
return configuration;
}
catch(ServiceException e) {
try {
throw new S3ExceptionMappingService().map("Cannot read bucket versioning status", e);
}
catch(AccessDeniedException l) {
log.warn(String.format("Missing permission to read versioning configuration for %s %s", container, e.getMessage()));
return VersioningConfiguration.empty();
}
catch(InteroperabilityException i) {
log.warn(String.format("Not supported to read versioning configuration for %s %s", container, e.getMessage()));
return VersioningConfiguration.empty();
}
}
}
示例4: endElement
import org.jets3t.service.model.S3BucketVersioningStatus; //導入依賴的package包/類
@Override
public void endElement(String name, String elementText) {
if (name.equals("Status")) {
this.status = elementText;
} else if (name.equals("MfaDelete")) {
this.mfaStatus = elementText;
} else if (name.equals("VersioningConfiguration")) {
this.versioningStatus = new S3BucketVersioningStatus(
"Enabled".equals(status),
"Enabled".equals(mfaStatus));
}
}
示例5: getBucketVersioningStatusImpl
import org.jets3t.service.model.S3BucketVersioningStatus; //導入依賴的package包/類
protected abstract S3BucketVersioningStatus getBucketVersioningStatusImpl(
String bucketName) throws S3ServiceException;
示例6: getVersioningStatus
import org.jets3t.service.model.S3BucketVersioningStatus; //導入依賴的package包/類
public S3BucketVersioningStatus getVersioningStatus() {
return this.versioningStatus;
}
示例7: parseVersioningConfigurationResponse
import org.jets3t.service.model.S3BucketVersioningStatus; //導入依賴的package包/類
/**
* @param inputStream
*
* @return
* true if the bucket has versioning enabled, false otherwise.
*
* @throws ServiceException
*/
public S3BucketVersioningStatus parseVersioningConfigurationResponse(
InputStream inputStream) throws ServiceException
{
VersioningConfigurationHandler handler = new VersioningConfigurationHandler();
parseXmlInputStream(handler, inputStream);
return handler.getVersioningStatus();
}
示例8: getBucketVersioningStatus
import org.jets3t.service.model.S3BucketVersioningStatus; //導入依賴的package包/類
/**
* Return versioning status of bucket, which reports on whether the given bucket
* has S3 object versioning enabled and whether multi-factor authentication is
* required to delete versions.
*
* @param bucketName
* the name of the bucket.
* @return
* versioning status of bucket
* @throws S3ServiceException
*/
public S3BucketVersioningStatus getBucketVersioningStatus(String bucketName)
throws S3ServiceException
{
return getBucketVersioningStatusImpl(bucketName);
}