Package com.exasol.bucketfs
Class WriteEnabledBucket
- java.lang.Object
-
- com.exasol.bucketfs.ReadEnabledBucket
-
- com.exasol.bucketfs.WriteEnabledBucket
-
- All Implemented Interfaces:
ReadOnlyBucket,UnsynchronizedBucket
- Direct Known Subclasses:
SyncAwareBucket
public class WriteEnabledBucket extends ReadEnabledBucket implements UnsynchronizedBucket
An abstraction for a bucket inside Exasol's BucketFS.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classWriteEnabledBucket.Builder<T extends WriteEnabledBucket.Builder<T>>Builder forWriteEnabledBucketobjects.
-
Field Summary
-
Fields inherited from class com.exasol.bucketfs.ReadEnabledBucket
bucketFsName, bucketName, client, ipAddress, port, readPassword, uploadHistory
-
Fields inherited from interface com.exasol.bucketfs.UnsynchronizedBucket
SUPPORTED_ARCHIVE_EXTENSIONS
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedWriteEnabledBucket(WriteEnabledBucket.Builder<? extends WriteEnabledBucket.Builder<?>> builder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static WriteEnabledBucket.Builder<? extends WriteEnabledBucket.Builder<?>>builder()Create builder for aWriteEnabledBucket.protected BucketAccessExceptioncreateUploadInterruptedException(URI uri)protected BucketAccessExceptioncreateUploadIoException(URI uri, IOException exception)StringgetWritePassword()Get the write password for the bucket.voiduploadFileNonBlocking(Path localPath, String pathInBucket)Upload a file to the bucket.voiduploadInputStreamNonBlocking(Supplier<InputStream> inputStreamSupplier, String pathInBucket)Upload the contents of an input stream to the bucket non-blocking.voiduploadStringContentNonBlocking(String content, String pathInBucket)Upload the contents of a string to the bucket.protected voiduploadWithBodyPublisher(String pathInBucket, URI uri, HttpRequest.BodyPublisher publisher, String what)-
Methods inherited from class com.exasol.bucketfs.ReadEnabledBucket
downloadFile, downloadFileAsString, evaluateRequestStatus, extendPathInBucketDownToFilename, getBucketFsName, getBucketName, getFullyQualifiedBucketName, getReadPassword, listContents, listContents, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.exasol.bucketfs.ReadOnlyBucket
downloadFile, downloadFileAsString, getBucketFsName, getBucketName, getFullyQualifiedBucketName, getReadPassword, listContents, listContents
-
-
-
-
Constructor Detail
-
WriteEnabledBucket
protected WriteEnabledBucket(WriteEnabledBucket.Builder<? extends WriteEnabledBucket.Builder<?>> builder)
-
-
Method Detail
-
getWritePassword
public String getWritePassword()
Description copied from interface:UnsynchronizedBucketGet the write password for the bucket.- Specified by:
getWritePasswordin interfaceUnsynchronizedBucket- Returns:
- write password.
-
uploadFileNonBlocking
public void uploadFileNonBlocking(Path localPath, String pathInBucket) throws BucketAccessException, TimeoutException, FileNotFoundException
Description copied from interface:UnsynchronizedBucketUpload a file to the bucket.Upload a file from a given local path to a URI pointing to a BucketFS bucket. If the bucket URI ends in a slash, that URI is interpreted as a directory inside the bucket and the original filename is appended.
This call immediately returns without checking whether or not the file is actually synchronized in the in BucketFS.
- Specified by:
uploadFileNonBlockingin interfaceUnsynchronizedBucket- Parameters:
localPath- path of the file to be uploadedpathInBucket- path inside the bucket- Throws:
BucketAccessException- if the file cannot be uploaded to the given URITimeoutException- if the synchronization check takes too longFileNotFoundException- in case the source file is not found
-
uploadWithBodyPublisher
protected void uploadWithBodyPublisher(String pathInBucket, URI uri, HttpRequest.BodyPublisher publisher, String what) throws BucketAccessException
- Throws:
BucketAccessException
-
createUploadIoException
protected BucketAccessException createUploadIoException(URI uri, IOException exception)
-
createUploadInterruptedException
protected BucketAccessException createUploadInterruptedException(URI uri)
-
uploadStringContentNonBlocking
public void uploadStringContentNonBlocking(String content, String pathInBucket) throws BucketAccessException, TimeoutException
Description copied from interface:UnsynchronizedBucketUpload the contents of a string to the bucket.This method is intended for writing small objects in BucketFS dynamically like for example configuration files. For large payload use
UnsynchronizedBucket.uploadFileNonBlocking(Path, String)instead.This call immediately returns without checking whether or not the file is actually synchronized in the in BucketFS.
- Specified by:
uploadStringContentNonBlockingin interfaceUnsynchronizedBucket- Parameters:
content- string to writepathInBucket- path inside the bucket- Throws:
BucketAccessException- if the file cannot be uploaded to the given URITimeoutException- if synchronization takes too long
-
uploadInputStreamNonBlocking
public void uploadInputStreamNonBlocking(Supplier<InputStream> inputStreamSupplier, String pathInBucket) throws BucketAccessException, TimeoutException
Description copied from interface:UnsynchronizedBucketUpload the contents of an input stream to the bucket non-blocking.- Specified by:
uploadInputStreamNonBlockingin interfaceUnsynchronizedBucket- Parameters:
inputStreamSupplier- supplier that provides the input streampathInBucket- path inside the bucket- Throws:
BucketAccessException- if the file cannot be uploaded to the given URITimeoutException- if synchronization takes too long
-
builder
public static WriteEnabledBucket.Builder<? extends WriteEnabledBucket.Builder<?>> builder()
Create builder for aWriteEnabledBucket.- Returns:
- builder
-
-