Package edu.wisc.library.ocfl.aws
Class OcflS3Client
- java.lang.Object
-
- edu.wisc.library.ocfl.aws.OcflS3Client
-
- All Implemented Interfaces:
CloudClient
public class OcflS3Client extends Object implements CloudClient
CloudClient implementation that uses Amazon's S3 synchronous v2 client
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classOcflS3Client.Builder
-
Constructor Summary
Constructors Constructor Description OcflS3Client(software.amazon.awssdk.services.s3.S3Client s3Client, String bucket)OcflS3Client(software.amazon.awssdk.services.s3.S3Client s3Client, String bucket, String prefix, BiConsumer<String,software.amazon.awssdk.services.s3.model.PutObjectRequest.Builder> putObjectModifier, BiConsumer<String,software.amazon.awssdk.services.s3.model.CreateMultipartUploadRequest.Builder> createMultipartModifier)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringbucket()booleanbucketExists()static OcflS3Client.Builderbuilder()Used to create a new OcflS3Client instance.CloudObjectKeycopyObject(String srcPath, String dstPath)voiddeleteObjects(Collection<String> objectPaths)voiddeletePath(String path)booleandirectoryExists(String path)PathdownloadFile(String srcPath, Path dstPath)InputStreamdownloadStream(String srcPath)StringdownloadString(String srcPath)HeadResulthead(String path)ListResultlist(String prefix)ListResultlistDirectory(String path)Stringprefix()voidsafeDeleteObjects(String... objectPaths)voidsafeDeleteObjects(Collection<String> objectPaths)CloudObjectKeyuploadBytes(String dstPath, byte[] bytes, String contentType)CloudObjectKeyuploadFile(Path srcPath, String dstPath)CloudObjectKeyuploadFile(Path srcPath, String dstPath, String contentType)
-
-
-
Constructor Detail
-
OcflS3Client
public OcflS3Client(software.amazon.awssdk.services.s3.S3Client s3Client, String bucket)- Parameters:
s3Client- aws sdk s3 clientbucket- s3 bucket- See Also:
builder()
-
OcflS3Client
public OcflS3Client(software.amazon.awssdk.services.s3.S3Client s3Client, String bucket, String prefix, BiConsumer<String,software.amazon.awssdk.services.s3.model.PutObjectRequest.Builder> putObjectModifier, BiConsumer<String,software.amazon.awssdk.services.s3.model.CreateMultipartUploadRequest.Builder> createMultipartModifier)- Parameters:
s3Client- aws sdk s3 clientbucket- s3 bucketprefix- key prefixputObjectModifier- hook for modifying putObject requestscreateMultipartModifier- hook for modifying createMultipartUpload requests- See Also:
builder()
-
-
Method Detail
-
builder
public static OcflS3Client.Builder builder()
Used to create a new OcflS3Client instance.- Returns:
- builder
-
bucket
public String bucket()
- Specified by:
bucketin interfaceCloudClient
-
prefix
public String prefix()
- Specified by:
prefixin interfaceCloudClient
-
uploadFile
public CloudObjectKey uploadFile(Path srcPath, String dstPath)
- Specified by:
uploadFilein interfaceCloudClient
-
uploadFile
public CloudObjectKey uploadFile(Path srcPath, String dstPath, String contentType)
- Specified by:
uploadFilein interfaceCloudClient
-
uploadBytes
public CloudObjectKey uploadBytes(String dstPath, byte[] bytes, String contentType)
- Specified by:
uploadBytesin interfaceCloudClient
-
copyObject
public CloudObjectKey copyObject(String srcPath, String dstPath)
- Specified by:
copyObjectin interfaceCloudClient
-
downloadFile
public Path downloadFile(String srcPath, Path dstPath)
- Specified by:
downloadFilein interfaceCloudClient
-
downloadStream
public InputStream downloadStream(String srcPath)
- Specified by:
downloadStreamin interfaceCloudClient
-
downloadString
public String downloadString(String srcPath)
- Specified by:
downloadStringin interfaceCloudClient
-
head
public HeadResult head(String path)
- Specified by:
headin interfaceCloudClient
-
list
public ListResult list(String prefix)
- Specified by:
listin interfaceCloudClient
-
listDirectory
public ListResult listDirectory(String path)
- Specified by:
listDirectoryin interfaceCloudClient
-
directoryExists
public boolean directoryExists(String path)
- Specified by:
directoryExistsin interfaceCloudClient
-
deletePath
public void deletePath(String path)
- Specified by:
deletePathin interfaceCloudClient
-
deleteObjects
public void deleteObjects(Collection<String> objectPaths)
- Specified by:
deleteObjectsin interfaceCloudClient
-
safeDeleteObjects
public void safeDeleteObjects(String... objectPaths)
- Specified by:
safeDeleteObjectsin interfaceCloudClient
-
safeDeleteObjects
public void safeDeleteObjects(Collection<String> objectPaths)
- Specified by:
safeDeleteObjectsin interfaceCloudClient
-
bucketExists
public boolean bucketExists()
- Specified by:
bucketExistsin interfaceCloudClient
-
-