public class MoleculeArchiveAmazonS3KeyValueAccess
extends java.lang.Object
Constructor and Description |
---|
MoleculeArchiveAmazonS3KeyValueAccess(com.amazonaws.services.s3.AmazonS3 s3,
java.lang.String bucketName)
Opens an
AmazonS3 client and a given bucket name. |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
addTrailingSlash(java.lang.String path)
When listing children objects for a group, must append a delimiter to the path (e.g.
|
java.lang.String[] |
components(java.lang.String path) |
java.lang.String |
compose(java.lang.String... components) |
void |
createDirectories(java.lang.String normalPath) |
void |
delete(java.lang.String normalPath) |
boolean |
exists(java.lang.String normalPath)
Test whether the
normalPath exists. |
boolean |
isDirectory(java.lang.String normalPath)
Test whether the path is a directory.
|
boolean |
isFile(java.lang.String normalPath)
Test whether the path is a file.
|
java.lang.String[] |
list(java.lang.String normalPath) |
java.lang.String[] |
listDirectories(java.lang.String normalPath) |
java.util.List<java.lang.String> |
listObjectKeys(java.lang.String normalPath) |
LockedChannel |
lockForReading(java.lang.String normalPath) |
LockedChannel |
lockForWriting(java.lang.String normalPath) |
java.lang.String |
normalize(java.lang.String path) |
static java.lang.String |
normalizeGroupPath(java.lang.String path)
Normalize a group path relative to a container's root, resulting in
removal of redundant "/", "./", resolution of relative "../",
and removal of leading slashes.
|
java.lang.String |
parent(java.lang.String path) |
static java.lang.String |
removeLeadingSlash(java.lang.String path)
When absolute paths are passed (e.g.
|
public MoleculeArchiveAmazonS3KeyValueAccess(com.amazonaws.services.s3.AmazonS3 s3, java.lang.String bucketName) throws java.io.IOException
AmazonS3
client and a given bucket name.s3
- the s3 instancebucketName
- the bucket namejava.io.IOException
- if the access could not be createdpublic java.lang.String[] components(java.lang.String path)
public java.lang.String compose(java.lang.String... components)
public java.lang.String parent(java.lang.String path)
public java.lang.String normalize(java.lang.String path)
public static java.lang.String normalizeGroupPath(java.lang.String path)
path
- to normalizepublic boolean exists(java.lang.String normalPath)
normalPath
exists.
Removes leading slash from normalPath
, and then checks whether
either path
or path + "/"
is a key.
normalPath
- is expected to be in normalized form, no further
efforts are made to normalize it.true
if path
exists, false
otherwisepublic static java.lang.String addTrailingSlash(java.lang.String path)
path
- the pathpublic static java.lang.String removeLeadingSlash(java.lang.String path)
path
- the pathpublic boolean isDirectory(java.lang.String normalPath)
Appends trailing "/" to normalPath
if there is none, removes
leading "/", and then checks whether resulting path
is a key.
normalPath
- is expected to be in normalized form, no further
efforts are made to normalize it.true
if path
(with trailing "/") exists as a key, false
otherwisepublic boolean isFile(java.lang.String normalPath)
Checks whether normalPath
has no trailing "/", then removes
leading "/" and checks whether the resulting path
is a key.
normalPath
- is expected to be in normalized form, no further
efforts are made to normalize it.true
if path
exists as a key and has no trailing slash, false
otherwisepublic LockedChannel lockForReading(java.lang.String normalPath) throws java.io.IOException
java.io.IOException
public LockedChannel lockForWriting(java.lang.String normalPath) throws java.io.IOException
java.io.IOException
public java.util.List<java.lang.String> listObjectKeys(java.lang.String normalPath)
public java.lang.String[] listDirectories(java.lang.String normalPath)
public java.lang.String[] list(java.lang.String normalPath) throws java.io.IOException
java.io.IOException
public void createDirectories(java.lang.String normalPath) throws java.io.IOException
java.io.IOException
public void delete(java.lang.String normalPath) throws java.io.IOException
java.io.IOException