Class Utils
- java.lang.Object
-
- org.apache.jackrabbit.oak.blob.cloud.s3.Utils
-
public final class Utils extends Object
Amazon S3 utilities.
-
-
Field Summary
Fields Modifier and Type Field Description static StringAWSDOTCOMconstants to define endpoint to various AWS regionstatic StringDASHstatic StringDEFAULT_AWS_BUCKET_REGIONThe default value AWS bucket region.static StringDEFAULT_CONFIG_FILEstatic StringDOTstatic StringS3static StringS3_ACCELERATIONstatic StringUS_EAST_1_AWS_BUCKET_REGIONThe value for the us-east-1 region.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Map<String,Object>asMap(Properties props)static software.amazon.awssdk.services.s3.presigner.S3PresignercreatePresigner(software.amazon.awssdk.services.s3.S3Client s3Client, Properties props)Creates anS3Presignerinstance using the providedS3Clientand S3 configuration properties.static DataEncryptiongetDataEncryption(Properties props)Determines the data encryption type to use for S3 operations based on the provided properties.static software.amazon.awssdk.services.s3.S3AsyncClientopenAsyncService(Properties prop)Create S3Client from properties.static software.amazon.awssdk.services.s3.S3ClientopenService(Properties prop, boolean accReq)Create S3Client from properties.static PropertiesreadConfig(String fileName)Read a configuration properties file.static voidsetRemoteStorageMode(Properties properties)Sets the remote storage mode in the provided properties based on the S3 endpoint.
-
-
-
Field Detail
-
DEFAULT_CONFIG_FILE
public static final String DEFAULT_CONFIG_FILE
- See Also:
- Constant Field Values
-
DEFAULT_AWS_BUCKET_REGION
public static final 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 String US_EAST_1_AWS_BUCKET_REGION
The value for the us-east-1 region.- See Also:
- Constant Field Values
-
AWSDOTCOM
public static final String AWSDOTCOM
constants to define endpoint to various AWS region- See Also:
- Constant Field Values
-
S3
public static final String S3
- See Also:
- Constant Field Values
-
S3_ACCELERATION
public static final String S3_ACCELERATION
- See Also:
- Constant Field Values
-
DOT
public static final String DOT
- See Also:
- Constant Field Values
-
DASH
public static final String DASH
- See Also:
- Constant Field Values
-
-
Method Detail
-
openService
public static software.amazon.awssdk.services.s3.S3Client openService(Properties prop, boolean accReq)
Create S3Client from properties.- Parameters:
prop- properties to configure @linkS3ClientaccReq- boolean indicating whether to accelerate requests- Returns:
S3Client
-
openAsyncService
public static software.amazon.awssdk.services.s3.S3AsyncClient openAsyncService(Properties prop)
Create S3Client from properties.- Parameters:
prop- properties to configure @linkS3Client- Returns:
S3Client
-
createPresigner
public static software.amazon.awssdk.services.s3.presigner.S3Presigner createPresigner(software.amazon.awssdk.services.s3.S3Client s3Client, Properties props)Creates anS3Presignerinstance using the providedS3Clientand S3 configuration properties.The presigner is used to generate pre-signed URLs for S3 operations, allowing secure, time-limited access to S3 resources without exposing credentials.
- Parameters:
s3Client- theS3Clientto use for presigning requestsprops- the properties containing S3 configuration (credentials, region, etc.)- Returns:
- a configured
S3Presignerinstance
-
readConfig
public static Properties readConfig(String fileName) throws 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:
IOException- if the file doesn't exist
-
asMap
public static Map<String,Object> asMap(Properties props)
-
getDataEncryption
public static DataEncryption getDataEncryption(Properties props)
Determines the data encryption type to use for S3 operations based on the provided properties.If the property
S3_ENCRYPTIONis set, returns the correspondingDataEncryptionenum value. If the property is not set or is invalid, returnsDataEncryption.NONE.- Parameters:
props- the properties containing S3 configuration- Returns:
- the
DataEncryptiontype to use
-
setRemoteStorageMode
public static void setRemoteStorageMode(Properties properties)
Sets the remote storage mode in the provided properties based on the S3 endpoint.If the endpoint contains "googleapis", the mode is set to GCP. Otherwise, it is set to S3. If the mode was previously set to S3 but the endpoint is for GCP, a warning is logged and the mode is overridden.
- Parameters:
properties- the properties to update with the remote storage mode
-
-