Class Utils
java.lang.Object
org.apache.jackrabbit.oak.blob.cloud.s3.Utils
Amazon S3 utilities.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionasMap
(Properties props) static void
deleteBucket
(String bucketName) Delete S3 bucket.static com.amazonaws.services.s3.AmazonS3Client
openService
(Properties prop) Create AmazonS3Client from properties.static Properties
readConfig
(String fileName) Read a configuration properties file.static boolean
waitForBucket
(@NotNull com.amazonaws.services.s3.AmazonS3 s3Client, @NotNull String bucketName) Waits for an S3 bucket, one we expect to exist, to report that it exists.
-
Field Details
-
DEFAULT_CONFIG_FILE
- See Also:
-
DEFAULT_AWS_BUCKET_REGION
The default value AWS bucket region.- See Also:
-
US_EAST_1_AWS_BUCKET_REGION
The value for the us-east-1 region.- See Also:
-
AWSDOTCOM
constants to define endpoint to various AWS region- See Also:
-
S3
- See Also:
-
DOT
- See Also:
-
DASH
- See Also:
-
-
Method Details
-
openService
Create AmazonS3Client from properties.- Parameters:
prop
- properties to configure @linkAmazonS3Client
- Returns:
AmazonS3Client
-
waitForBucket
public static boolean waitForBucket(@NotNull @NotNull com.amazonaws.services.s3.AmazonS3 s3Client, @NotNull @NotNull String bucketName) Waits for an S3 bucket, one we expect to exist, to report that it exists. A check for the bucket is called with a limited number of repeats with an increasing backoff. Usually you would call this after creating a bucket to block until the bucket is actually available before moving forward with other tasks that expect the bucket to be available.- Parameters:
s3Client
- The AmazonS3 client connection to the storage service.bucketName
- The name of the bucket to check.- Returns:
- True if the bucket exists; false otherwise.
-
deleteBucket
Delete S3 bucket. This method first deletes all objects from bucket and then delete empty bucket.- Parameters:
bucketName
- the bucket name.- Throws:
IOException
-
readConfig
Read a configuration properties file. If the file name ends with ";burn", the file is deleted after reading.- Parameters:
fileName
- the properties file name- Returns:
- the properties
- Throws:
IOException
- if the file doesn't exist
-
asMap
-