Class Utils
- java.lang.Object
-
- org.apache.jackrabbit.oak.blob.cloud.s3.Utils
-
public final class Utils extends java.lang.Object
Amazon S3 utilities.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
AWSDOTCOM
constants to define endpoint to various AWS regionstatic java.lang.String
DASH
static java.lang.String
DEFAULT_AWS_BUCKET_REGION
The default value AWS bucket region.static java.lang.String
DEFAULT_CONFIG_FILE
static java.lang.String
DOT
static java.lang.String
S3
static java.lang.String
US_EAST_1_AWS_BUCKET_REGION
The value for the us-east-1 region.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.Map<java.lang.String,java.lang.Object>
asMap(java.util.Properties props)
static void
deleteBucket(java.lang.String bucketName)
Delete S3 bucket.static com.amazonaws.services.s3.AmazonS3Client
openService(java.util.Properties prop)
Create AmazonS3Client from properties.static java.util.Properties
readConfig(java.lang.String fileName)
Read a configuration properties file.static boolean
waitForBucket(@NotNull com.amazonaws.services.s3.AmazonS3 s3Client, @NotNull java.lang.String bucketName)
Waits for an S3 bucket, one we expect to exist, to report that it exists.
-
-
-
Field Detail
-
DEFAULT_CONFIG_FILE
public static final java.lang.String DEFAULT_CONFIG_FILE
- See Also:
- Constant Field Values
-
DEFAULT_AWS_BUCKET_REGION
public static final java.lang.String DEFAULT_AWS_BUCKET_REGION
The default value AWS bucket region.- See Also:
- Constant Field Values
-
US_EAST_1_AWS_BUCKET_REGION
public static final java.lang.String US_EAST_1_AWS_BUCKET_REGION
The value for the us-east-1 region.- See Also:
- Constant Field Values
-
AWSDOTCOM
public static final java.lang.String AWSDOTCOM
constants to define endpoint to various AWS region- See Also:
- Constant Field Values
-
S3
public static final java.lang.String S3
- See Also:
- Constant Field Values
-
DOT
public static final java.lang.String DOT
- See Also:
- Constant Field Values
-
DASH
public static final java.lang.String DASH
- See Also:
- Constant Field Values
-
-
Method Detail
-
openService
public static com.amazonaws.services.s3.AmazonS3Client openService(java.util.Properties prop)
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 java.lang.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
public static void deleteBucket(java.lang.String bucketName) throws java.io.IOException
Delete S3 bucket. This method first deletes all objects from bucket and then delete empty bucket.- Parameters:
bucketName
- the bucket name.- Throws:
java.io.IOException
-
readConfig
public static java.util.Properties readConfig(java.lang.String fileName) throws java.io.IOException
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:
java.io.IOException
- if the file doesn't exist
-
asMap
public static java.util.Map<java.lang.String,java.lang.Object> asMap(java.util.Properties props)
-
-