Example usage for com.amazonaws.services.s3.model Bucket setCreationDate

List of usage examples for com.amazonaws.services.s3.model Bucket setCreationDate

Introduction

In this page you can find the example usage for com.amazonaws.services.s3.model Bucket setCreationDate.

Prototype

public void setCreationDate(Date creationDate) 

Source Link

Document

For internal use only.

Usage

From source file:com.thinkbiganalytics.kylo.catalog.aws.AmazonS3Util.java

License:Apache License

/**
 * Creates an S3 bucket with the specified name.
 *//*from   ww w.j  a v a  2  s . co m*/
@Nonnull
@SuppressWarnings("WeakerAccess")
public static Bucket createBucket(@Nonnull final String name) {
    final Bucket bucket = new Bucket(name);
    bucket.setCreationDate(new Date());
    return bucket;
}

From source file:com.upplication.s3fs.util.AmazonS3ClientMock.java

License:Open Source License

public AmazonS3ClientMock(Path base) throws IOException {
    super(null);/* w  w  w  . java  2 s.c o m*/
    // construimos el bucket
    // 1 level: buckets
    try (DirectoryStream<Path> dir = Files.newDirectoryStream(base)) {
        for (final Path bucketPath : dir) {
            BasicFileAttributes attr = Files.readAttributes(bucketPath, BasicFileAttributes.class);
            final Bucket bucket = new Bucket();
            bucket.setCreationDate(new Date(attr.creationTime().toMillis()));
            bucket.setName(bucketPath.getFileName().toString());
            bucket.setOwner(owner);
            final LinkedHashSet<S3Element> elemnts = new LinkedHashSet<>();
            // all s3object
            Files.walkFileTree(bucketPath, new SimpleFileVisitor<Path>() {
                @Override
                public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs)
                        throws IOException {
                    if (Files.newDirectoryStream(dir).iterator().hasNext()) {
                        // add only last elements
                        return FileVisitResult.CONTINUE;
                    } else {
                        S3Element obj = parse(dir, bucketPath);

                        elemnts.add(obj);
                    }

                    return FileVisitResult.CONTINUE;
                }

                @Override
                public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
                    S3Element obj = parse(file, bucketPath);
                    elemnts.add(obj);
                    return FileVisitResult.CONTINUE;
                }
            });
            objects.put(bucket, elemnts);
        }
    }
}

From source file:edu.si.services.beans.cameratrap.AmazonS3ClientMock.java

License:Apache License

@Override
public Bucket createBucket(CreateBucketRequest createBucketRequest)
        throws AmazonClientException, AmazonServiceException {
    if ("nonExistingBucket".equals(createBucketRequest.getBucketName())) {
        nonExistingBucketCreated = true;
    }/*from w w w .  j  a  va 2s  . c  o  m*/

    Bucket bucket = new Bucket();
    bucket.setName(createBucketRequest.getBucketName());
    bucket.setCreationDate(new Date());
    bucket.setOwner(new Owner("c2efc7302b9011ba9a78a92ac5fd1cd47b61790499ab5ddf5a37c31f0638a8fc ",
            "Christian Mueller"));
    buckets.add(bucket);
    return bucket;
}

From source file:eu.openg.aws.s3.internal.AmazonS3Fake.java

License:Apache License

private void addBucket(String bucketName) {
    Bucket bucket = new Bucket(bucketName);
    bucket.setOwner(OWNER);/*from   w ww  .  j av a 2  s .  co  m*/
    bucket.setCreationDate(Date.from(clock.instant()));
    buckets.put(bucketName, new FakeBucketsContainer(bucket, clock));
}

From source file:org.apache.camel.component.aws.s3.AmazonS3ClientMock.java

License:Apache License

@Override
public Bucket createBucket(CreateBucketRequest createBucketRequest)
        throws AmazonClientException, AmazonServiceException {
    if ("nonExistingBucket".equals(createBucketRequest.getBucketName())) {
        nonExistingBucketCreated = true;
    }/*w w  w . ja v a2 s. c om*/

    Bucket bucket = new Bucket();
    bucket.setName(createBucketRequest.getBucketName());
    bucket.setCreationDate(new Date());
    bucket.setOwner(new Owner("c2efc7302b9011ba9a78a92ac5fd1cd47b61790499ab5ddf5a37c31f0638a8fc ",
            "Christian Mueller"));
    return bucket;
}

From source file:org.apache.camel.itest.osgi.aws.AmazonS3ClientMock.java

License:Apache License

@Override
public Bucket createBucket(CreateBucketRequest createBucketRequest)
        throws AmazonClientException, AmazonServiceException {
    Bucket bucket = new Bucket();
    bucket.setName(createBucketRequest.getBucketName());
    bucket.setCreationDate(new Date());
    bucket.setOwner(new Owner("c2efc7302b9011ba9a78a92ac5fd1cd47b61790499ab5ddf5a37c31f0638a8fc ",
            "Christian Mueller"));
    return bucket;
}

From source file:org.weakref.s3fs.util.AmazonS3ClientMock.java

License:Apache License

public AmazonS3ClientMock(Path base) throws IOException {
    super(null);//from  w ww .j a  v  a  2 s. co m
    // construimos el bucket
    // 1 level: buckets
    try (DirectoryStream<Path> dir = Files.newDirectoryStream(base)) {
        for (final Path bucketPath : dir) {
            BasicFileAttributes attr = Files.readAttributes(bucketPath, BasicFileAttributes.class);
            final Bucket bucket = new Bucket();
            bucket.setCreationDate(new Date(attr.creationTime().toMillis()));
            bucket.setName(bucketPath.getFileName().toString());
            bucket.setOwner(owner);
            final List<S3Element> elemnts = new ArrayList<>();
            // all s3object
            Files.walkFileTree(bucketPath, new SimpleFileVisitor<Path>() {
                @Override
                public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs)
                        throws IOException {
                    if (Files.newDirectoryStream(dir).iterator().hasNext()) {
                        // add only last elements
                        return FileVisitResult.CONTINUE;
                    } else {
                        S3Element obj = parse(dir, bucketPath);

                        elemnts.add(obj);
                    }

                    return FileVisitResult.CONTINUE;
                }

                @Override
                public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
                    S3Element obj = parse(file, bucketPath);
                    elemnts.add(obj);
                    return FileVisitResult.CONTINUE;
                }
            });
            objects.put(bucket, elemnts);
        }
    }
}