Class CloudObjectLocation


  • public class CloudObjectLocation
    extends Object
    Common type for 'bucket' and 'path' concept of cloud objects to allow code sharing between cloud specific implementations. bucket and path should NOT be URL encoded. The intention is that this is used as a common representation for storage objects as an alternative to dealing in URI directly, but still provide a mechanism to round-trip with a URI. In common clouds, bucket names must be dns compliant: https://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html https://docs.microsoft.com/en-us/rest/api/storageservices/naming-and-referencing-containers--blobs--and-metadata https://cloud.google.com/storage/docs/naming The constructor ensures that bucket names are DNS compliant by checking that the URL encoded form of the bucket matches the supplied value. Technically it should probably confirm that the bucket is also all lower-case, but S3 has a legacy mode where buckets did not have to be compliant so we can't enforce that here unfortunately.
    • Constructor Detail

      • CloudObjectLocation

        public CloudObjectLocation​(String bucket,
                                   String path)
      • CloudObjectLocation

        public CloudObjectLocation​(URI uri)
    • Method Detail

      • validateUriScheme

        public static URI validateUriScheme​(String scheme,
                                            URI uri)
      • toUri

        public URI toUri​(String scheme)
        Given a scheme, encode bucket and path into a URI. In all clouds bucket names must be dns compliant, so it does not require encoding There is no such restriction on object names, so they will be URL encoded when constructing the URI
      • getBucket

        public String getBucket()
      • getPath

        public String getPath()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object