Interface ReadOnlyBucket
-
- All Known Subinterfaces:
Bucket,UnsynchronizedBucket
- All Known Implementing Classes:
ReadEnabledBucket,SyncAwareBucket,WriteEnabledBucket
public interface ReadOnlyBucketInterface for read-only bucket access.
-
-
Field Summary
Fields Modifier and Type Field Description static StringPATH_IN_UDF_PREFIXPrefix for building UDF-visible paths to buckets in BucketFS.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voiddownloadFile(String pathInBucket, Path localPath)Download a file from a bucket to a local filesystem.StringdownloadFileAsString(String pathInBucket)Download a file from a bucket into a string.StringgetBucketFsName()StringgetBucketName()StringgetFullyQualifiedBucketName()Get the fully qualified name of the bucket.default StringgetPathInUdf()Return the UDF-visible path to the root of this bucket within BucketFS.default StringgetPathInUdf(String fileInBucketFs)Return the UDF-visible path to a specific file within this bucket in BucketFS.StringgetReadPassword()Get the read password for the bucket.List<String>listContents()List the contents of a bucket.List<String>listContents(String path)List the contents of a path inside a bucket.List<String>listContentsRecursively()Recursively list the contents of a bucket.List<String>listContentsRecursively(String path)Recursively list the contents of a path inside a bucket.
-
-
-
Field Detail
-
PATH_IN_UDF_PREFIX
static final String PATH_IN_UDF_PREFIX
Prefix for building UDF-visible paths to buckets in BucketFS.In Exasol, UDFs see BucketFS under
/buckets/. This constant helps build correct file paths as seen from within UDFs.- See Also:
getPathInUdf(),getPathInUdf(String), Constant Field Values
-
-
Method Detail
-
getBucketFsName
String getBucketFsName()
- Returns:
- name of the BucketFS filesystem this bucket belongs to
-
getBucketName
String getBucketName()
- Returns:
- name of the bucket
-
getFullyQualifiedBucketName
String getFullyQualifiedBucketName()
Get the fully qualified name of the bucket.- Returns:
- fully qualified name consisting of service name and bucket name
-
getReadPassword
String getReadPassword()
Get the read password for the bucket.- Returns:
- read password
-
listContents
List<String> listContents() throws BucketAccessException
List the contents of a bucket.- Returns:
- bucket contents
- Throws:
BucketAccessException- if the contents are not accessible or the path is invalid
-
listContentsRecursively
List<String> listContentsRecursively() throws BucketAccessException
Recursively list the contents of a bucket.- Returns:
- bucket contents
- Throws:
BucketAccessException- if the contents are not accessible or the path is invalid
-
listContents
List<String> listContents(String path) throws BucketAccessException
List the contents of a path inside a bucket.- Parameters:
path- relative path from the bucket root- Returns:
- list of file system entries
- Throws:
BucketAccessException- if the contents are not accessible or the path is invalid
-
listContentsRecursively
List<String> listContentsRecursively(String path) throws BucketAccessException
Recursively list the contents of a path inside a bucket.- Parameters:
path- relative path from the bucket root- Returns:
- list of file system entries
- Throws:
BucketAccessException- if the contents are not accessible or the path is invalid
-
downloadFile
void downloadFile(String pathInBucket, Path localPath) throws BucketAccessException
Download a file from a bucket to a local filesystem.- Parameters:
pathInBucket- path of the file in BucketFSlocalPath- local path the file is downloaded to- Throws:
BucketAccessException- if the local file does not exist or is not accessible or if the download failed
-
downloadFileAsString
String downloadFileAsString(String pathInBucket) throws BucketAccessException
Download a file from a bucket into a string.- Parameters:
pathInBucket- path of the file in BucketFS- Returns:
- file contents as string
- Throws:
BucketAccessException- if the local file does not exist or is not accessible or if the download failed
-
getPathInUdf
default String getPathInUdf()
Return the UDF-visible path to the root of this bucket within BucketFS.This method ensures consistency and avoids human error by generating the correct chrooted path as seen from within a User-Defined Function (UDF) environment.
In Exasol, BucketFS is the only accessible filesystem for UDFs and it operates in a chrooted environment. As such, paths inside UDFs differ from those on the host system or exposed via the BucketFS web interface. This method abstracts away those differences and provides the correct UDF-local path.
- Returns:
- the absolute path to the bucket as seen inside the UDF
-
getPathInUdf
default String getPathInUdf(String fileInBucketFs)
Return the UDF-visible path to a specific file within this bucket in BucketFS.This method ensures that the path to the given file is correctly formed in the context of a UDF environment, taking into account the chrooted nature of BucketFS.
This is useful for referencing files inside a bucket from UDFs, where the apparent file paths are isolated from the underlying host filesystem.
- Parameters:
fileInBucketFs- the relative path or name of the file inside the bucket- Returns:
- the absolute path to the file as seen inside the UDF
-
-