本文整理汇总了Java中org.jets3t.service.model.BaseVersionOrDeleteMarker类的典型用法代码示例。如果您正苦于以下问题:Java BaseVersionOrDeleteMarker类的具体用法?Java BaseVersionOrDeleteMarker怎么用?Java BaseVersionOrDeleteMarker使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BaseVersionOrDeleteMarker类属于org.jets3t.service.model包,在下文中一共展示了BaseVersionOrDeleteMarker类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: VersionOrDeleteMarkersChunk
import org.jets3t.service.model.BaseVersionOrDeleteMarker; //导入依赖的package包/类
public VersionOrDeleteMarkersChunk(String prefix, String delimiter,
BaseVersionOrDeleteMarker[] items, String[] commonPrefixes,
String nextKeyMarker, String nextVersionIdMarker)
{
this.prefix = prefix;
this.delimiter = delimiter;
this.items = items;
this.commonPrefixes = commonPrefixes;
this.nextKeyMarker = nextKeyMarker;
this.nextVersionIdMarker = nextVersionIdMarker;
}
示例2: listVersionedObjectsImpl
import org.jets3t.service.model.BaseVersionOrDeleteMarker; //导入依赖的package包/类
@Override
protected BaseVersionOrDeleteMarker[] listVersionedObjectsImpl(String bucketName,
String prefix, String delimiter, String keyMarker, String versionMarker,
long maxListingLength) throws S3ServiceException
{
return listVersionedObjectsInternal(bucketName, prefix, delimiter,
maxListingLength, true, keyMarker, versionMarker).getItems();
}
示例3: getObjectVersions
import org.jets3t.service.model.BaseVersionOrDeleteMarker; //导入依赖的package包/类
/**
* Return version information for a specific object.
* <p>
* This is a convenience function that applies logic in addition to the LISTVERSIONS
* S3 operation to simplify retrieval of an object's version history. This method
* is *not* the most efficient way of retrieving version history in bulk, so if you
* need version history for multiple objects you should use the
* {@link #listVersionedObjects(String, String, String)} or
* {@link #listVersionedObjectsChunked(String, String, String, long, String, String, boolean)}
* methods instead.
*
* @param bucketName
* the name of the versioned bucket containing the object.
* @param objectKey
* the key identifying the object.
* @return
* an array of {@link S3Version} and {@link S3DeleteMarker} objects that describe
* the version history of the given object.
*
* @throws S3ServiceException
*/
public BaseVersionOrDeleteMarker[] getObjectVersions(String bucketName, String objectKey)
throws S3ServiceException
{
BaseVersionOrDeleteMarker[] matchesForNamePrefix =
listVersionedObjectsImpl(bucketName, objectKey, null, null, null, 1000);
// Limit results to only matches for the exact object key name
int exactMatchCount = 0;
for (int i = 0; i < matchesForNamePrefix.length && i <= exactMatchCount; i++) {
if (matchesForNamePrefix[i].getKey().equals(objectKey)) {
exactMatchCount++;
}
}
BaseVersionOrDeleteMarker[] exactMatches = new BaseVersionOrDeleteMarker[exactMatchCount];
System.arraycopy(matchesForNamePrefix, 0, exactMatches, 0, exactMatchCount);
return exactMatches;
}
示例4: listVersionedObjectsImpl
import org.jets3t.service.model.BaseVersionOrDeleteMarker; //导入依赖的package包/类
protected abstract BaseVersionOrDeleteMarker[] listVersionedObjectsImpl(String bucketName,
String prefix, String delimiter, String keyMarker, String versionMarker,
long maxListingLength) throws S3ServiceException;
示例5: getItems
import org.jets3t.service.model.BaseVersionOrDeleteMarker; //导入依赖的package包/类
public BaseVersionOrDeleteMarker[] getItems() {
return items;
}
示例6: testDeleteMarkerDeletionAndPromotion
import org.jets3t.service.model.BaseVersionOrDeleteMarker; //导入依赖的package包/类
@Test
public void testDeleteMarkerDeletionAndPromotion()
throws IOException, URISyntaxException,
ServiceException, NoSuchAlgorithmException {
S3HdfsPath s3HdfsPath1 = testUtil.setUpS3HdfsPath("folder", "file1");
// Enable versioning
S3Bucket retBucket =
s3Service.createBucket(new S3Bucket(s3HdfsPath1.getBucketName()));
s3Service.enableBucketVersioning(retBucket.getName());
// Put new object
File file1 = testUtil.getFile(BIG_SIZE);
File file2 = testUtil.getFile(SMALL_SIZE);
S3Object object1 = new S3Object(s3HdfsPath1.getObjectName());
object1.setDataInputFile(file1);
S3Object object2 = new S3Object(s3HdfsPath1.getObjectName());
object2.setDataInputFile(file2);
s3Service.putObject(s3HdfsPath1.getBucketName(), object1);
s3Service.putObject(s3HdfsPath1.getBucketName(), object2);
FileStatus[] fs =
hdfs.listStatus(new Path(s3HdfsPath1.getHdfsRootObjectPath()));
assertEquals(2, fs.length);
s3Service.deleteObject(s3HdfsPath1.getBucketName(), s3HdfsPath1.getObjectName());
FileStatus[] fs2 =
hdfs.listStatus(new Path(s3HdfsPath1.getHdfsRootObjectPath()));
assertEquals(3, fs2.length);
BaseVersionOrDeleteMarker[] versions =
s3Service.getObjectVersions(s3HdfsPath1.getBucketName(),
s3HdfsPath1.getObjectName());
for (BaseVersionOrDeleteMarker version : versions) {
System.out.println(version.toString());
if (version.isDeleteMarker()) {
// This will delete the latest version, causing promotion to occur.
s3Service.deleteVersionedObject(version.getVersionId(),
s3HdfsPath1.getBucketName(), s3HdfsPath1.getObjectName());
}
}
FileStatus[] fs3 =
hdfs.listStatus(new Path(s3HdfsPath1.getHdfsRootObjectPath()));
assertEquals(2, fs3.length);
}
示例7: testListVersions
import org.jets3t.service.model.BaseVersionOrDeleteMarker; //导入依赖的package包/类
@Test
public void testListVersions()
throws IOException, URISyntaxException,
ServiceException, NoSuchAlgorithmException {
S3HdfsPath s3HdfsPath1 = testUtil.setUpS3HdfsPath("folder", "file1");
// Enable versioning
S3Bucket retBucket =
s3Service.createBucket(new S3Bucket(s3HdfsPath1.getBucketName()));
s3Service.enableBucketVersioning(retBucket.getName());
// Put new object
File file1 = testUtil.getFile(BIG_SIZE);
File file2 = testUtil.getFile(SMALL_SIZE);
S3Object object1 = new S3Object(s3HdfsPath1.getObjectName());
object1.setDataInputFile(file1);
S3Object object2 = new S3Object(s3HdfsPath1.getObjectName());
object2.setDataInputFile(file2);
s3Service.putObject(s3HdfsPath1.getBucketName(), object1);
s3Service.putObject(s3HdfsPath1.getBucketName(), object2);
FileStatus[] fs =
hdfs.listStatus(new Path(s3HdfsPath1.getHdfsRootObjectPath()));
assertEquals(2, fs.length);
if (fs[0].getPath().getName().equals(DEFAULT_VERSION)) {
assertTrue(fs[1].getPath().getName().matches("[0-9A-z.-]+"));
s3HdfsPath1.setVersion(fs[1].getPath().getName());
} else {
assertTrue(fs[0].getPath().getName().matches("[0-9A-z.-]+"));
assertEquals(DEFAULT_VERSION, fs[1].getPath().getName());
s3HdfsPath1.setVersion(fs[0].getPath().getName());
}
BaseVersionOrDeleteMarker[] versions = s3Service.getObjectVersions(
s3HdfsPath1.getBucketName(), s3HdfsPath1.getObjectName());
System.out.println(versions[0].toString());
System.out.println(versions[1].toString());
}
示例8: listVersionedObjects
import org.jets3t.service.model.BaseVersionOrDeleteMarker; //导入依赖的package包/类
/**
* Lists versioning information in a versioned bucket where the objects
* match a given constraints. The S3 service will also be instructed to send
* response messages containing no more than a given number of object results.
* <p>
* This operation can only be performed by the bucket owner.
*
* @param bucketName
* the name of the the versioned bucket whose contents will be listed.
* @param prefix
* only objects with a key that starts with this prefix will be listed
* @param delimiter
* only list objects with key names up to this delimiter, may be null.
* See note above.
* @return
* the set of objects contained in a bucket whose keys start with the given prefix.
* @throws S3ServiceException
*/
public BaseVersionOrDeleteMarker[] listVersionedObjects(String bucketName, String prefix,
String delimiter)
throws S3ServiceException
{
return listVersionedObjectsImpl(bucketName, prefix, delimiter, null, null, 1000);
}
示例9: getItems
import org.jets3t.service.model.BaseVersionOrDeleteMarker; //导入依赖的package包/类
/**
* @return
* the S3 objects contained in the listing.
*/
public BaseVersionOrDeleteMarker[] getItems() {
return items.toArray(new BaseVersionOrDeleteMarker[items.size()]);
}