public class ThreddsS3ClientImpl extends java.lang.Object implements ThreddsS3Client
ThreddsS3Client
.Constructor and Description |
---|
ThreddsS3ClientImpl() |
ThreddsS3ClientImpl(com.amazonaws.services.s3.AmazonS3Client s3Client) |
Modifier and Type | Method and Description |
---|---|
com.amazonaws.services.s3.model.ObjectMetadata |
getObjectMetadata(S3URI s3uri)
Gets the metadata for the specified Amazon S3 object without actually fetching the object itself.
|
com.amazonaws.services.s3.model.ObjectListing |
listObjects(S3URI s3uri)
Returns a listing of the objects located in the "virtual filesystem" at the specified URI.
|
java.io.File |
saveObjectToFile(S3URI s3uri,
java.io.File file)
Gets the object metadata for the object stored in Amazon S3 under the specified bucket and key,
and saves the object contents to the specified file.
|
public ThreddsS3ClientImpl()
public ThreddsS3ClientImpl(com.amazonaws.services.s3.AmazonS3Client s3Client)
public com.amazonaws.services.s3.model.ObjectMetadata getObjectMetadata(S3URI s3uri)
ThreddsS3Client
getObjectMetadata
in interface ThreddsS3Client
s3uri
- the Amazon S3 URI of the object whose metadata is being retrieved.null
if there is no S3 bucket with the specified name that has the specified key.public com.amazonaws.services.s3.model.ObjectListing listObjects(S3URI s3uri)
ThreddsS3Client
s3uri.getKey()
is interpreted as a path, and only objects (accessible via
ObjectListing.getObjectSummaries()
) or "directories" (accessible via
ObjectListing.getCommonPrefixes()
) that have that prefix will be part of the returned listing.
NOTE: To manage large result sets, Amazon S3 uses pagination to split them into multiple responses. As a consequence, this listing will only include the first 1000-or-so results.
TODO: Extend this API so that it allows the retrieval of more than 1000 results.
listObjects
in interface ThreddsS3Client
s3uri
- the Amazon S3 URI of the "virtual directory" whose objects are being retrieved.null
if the specified URI does not denote an existing virtual
directory. Otherwise, the result will be non-null and non-empty. That is, it will have at least one
object summary or at least one common prefix.AmazonS3.listObjects(String)
public java.io.File saveObjectToFile(S3URI s3uri, java.io.File file) throws java.io.IOException
ThreddsS3Client
saveObjectToFile
in interface ThreddsS3Client
s3uri
- the Amazon S3 URI of the object whose content is being saved.file
- indicates the file (which might already exist) where to save the object content being downloading
from Amazon S3.null
if there is no S3 bucket with the specified name that has the specified key.java.io.IOException
- if some I/O error occurred on the local filesystem while writing to file.