Example usage for com.amazonaws.services.s3 AmazonS3URI getVersionId

List of usage examples for com.amazonaws.services.s3 AmazonS3URI getVersionId

Introduction

In this page you can find the example usage for com.amazonaws.services.s3 AmazonS3URI getVersionId.

Prototype

public String getVersionId() 

Source Link

Usage

From source file:com.netflix.genie.common.internal.aws.s3.S3ProtocolResolver.java

License:Apache License

/**
 * {@inheritDoc}//from w  ww. j ava 2s  .c o m
 */
@Override
public Resource resolve(final String location, final ResourceLoader resourceLoader) {
    log.debug("Attempting to resolve if {} is a S3 resource or not", location);
    final AmazonS3URI s3URI;
    try {
        s3URI = new AmazonS3URI(location);
    } catch (final IllegalArgumentException iae) {
        log.debug("{} is not a valid S3 resource (Error message: {}).", location, iae.getMessage());
        return null;
    }

    final AmazonS3 client = this.s3ClientFactory.getClient(s3URI);

    log.debug("{} is a valid S3 resource.", location);

    // TODO: This implementation from Spring Cloud AWS always wraps the passed in client with a proxy that follows
    //       redirects. I'm not sure if we want that or not. Probably ok for now but maybe revisit later?
    return new SimpleStorageResource(client, s3URI.getBucket(), s3URI.getKey(), this.s3TaskExecutor,
            s3URI.getVersionId());
}