Interface CloudClient
-
public interface CloudClientWrapper interface abstracting cloud provider clients
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Stringbucket()The name of the bucket the OCFL repository is in.booleanbucketExists()Returns true if the storage bucket existsCloudObjectKeycopyObject(String srcPath, String dstPath)Copies an object from one location to another within the same bucket.voiddeleteObjects(Collection<String> objectKeys)Deletes all of the specified objects.voiddeletePath(String path)Deletes all of the objects under the specified pathPathdownloadFile(String srcPath, Path dstPath)Downloads an object to the local filesystem.InputStreamdownloadStream(String srcPath)Downloads and object and performs a fixity check as it streams to disk.StringdownloadString(String srcPath)Downloads an object to a string.HeadResulthead(String path)Heads the object at the specified path.ListResultlist(String prefix)Lists all of the keys under a prefix.ListResultlistDirectory(String path)Lists all of the keys within a virtual directory.Stringprefix()The key prefix of all objects within the OCFL repository.voidsafeDeleteObjects(String... objectKeys)Deletes all of the objects and does not throw an exception on failurevoidsafeDeleteObjects(Collection<String> objectKeys)Deletes all of the objects and does not throw an exception on failureCloudObjectKeyuploadBytes(String dstPath, byte[] bytes, String contentType)Uploads an object with byte contentCloudObjectKeyuploadFile(Path srcPath, String dstPath)Uploads a file to the destination, and returns the object key.CloudObjectKeyuploadFile(Path srcPath, String dstPath, String contentType)Uploads a file to the destination, and returns the object key.
-
-
-
Method Detail
-
bucket
String bucket()
The name of the bucket the OCFL repository is in.- Returns:
- bucket name
-
prefix
String prefix()
The key prefix of all objects within the OCFL repository. This may be empty. Multiple different OCFL repositories may be stored in the same bucket if they use different key prefixes.- Returns:
- the key prefix common to all objects in the repository
-
uploadFile
CloudObjectKey uploadFile(Path srcPath, String dstPath)
Uploads a file to the destination, and returns the object key.- Parameters:
srcPath- src filedstPath- object path- Returns:
- object key
-
uploadFile
CloudObjectKey uploadFile(Path srcPath, String dstPath, String contentType)
Uploads a file to the destination, and returns the object key.- Parameters:
srcPath- src filedstPath- object pathcontentType- the content type of the data- Returns:
- object key
-
uploadBytes
CloudObjectKey uploadBytes(String dstPath, byte[] bytes, String contentType)
Uploads an object with byte content- Parameters:
dstPath- object pathbytes- the object contentcontentType- the content type of the data- Returns:
- object key
-
copyObject
CloudObjectKey copyObject(String srcPath, String dstPath)
Copies an object from one location to another within the same bucket.- Parameters:
srcPath- source object keydstPath- destination object path- Returns:
- the destination key
- Throws:
KeyNotFoundException- when srcPath not found
-
downloadFile
Path downloadFile(String srcPath, Path dstPath)
Downloads an object to the local filesystem.- Parameters:
srcPath- object keydstPath- path to write the file to- Returns:
- the destination path
- Throws:
KeyNotFoundException- when srcPath not found
-
downloadStream
InputStream downloadStream(String srcPath)
Downloads and object and performs a fixity check as it streams to disk.- Parameters:
srcPath- object key- Returns:
- stream of object content
- Throws:
KeyNotFoundException- when srcPath not found
-
downloadString
String downloadString(String srcPath)
Downloads an object to a string. This assumes that the object is UTF-8 encoded.- Parameters:
srcPath- object key- Returns:
- string content of the object
- Throws:
KeyNotFoundException- when srcPath not found
-
head
HeadResult head(String path)
Heads the object at the specified path.- Parameters:
path- object key- Returns:
- head details
- Throws:
KeyNotFoundException- when path not found
-
list
ListResult list(String prefix)
Lists all of the keys under a prefix. No delimiter is used.- Parameters:
prefix- the key prefix- Returns:
- list response
-
listDirectory
ListResult listDirectory(String path)
Lists all of the keys within a virtual directory. Only keys that fall between the specified prefix and the next '/' are returned.- Parameters:
path- the key prefix to list, if it does not end in a '/' one is appended- Returns:
- list response
-
deletePath
void deletePath(String path)
Deletes all of the objects under the specified path- Parameters:
path- the path prefix to delete
-
deleteObjects
void deleteObjects(Collection<String> objectKeys)
Deletes all of the specified objects. If an object does not exist, nothing happens.- Parameters:
objectKeys- keys to delete
-
safeDeleteObjects
void safeDeleteObjects(String... objectKeys)
Deletes all of the objects and does not throw an exception on failure- Parameters:
objectKeys- keys to delete
-
safeDeleteObjects
void safeDeleteObjects(Collection<String> objectKeys)
Deletes all of the objects and does not throw an exception on failure- Parameters:
objectKeys- keys to delete
-
bucketExists
boolean bucketExists()
Returns true if the storage bucket exists- Returns:
- if the bucket exists
-
-