Search in sources :

Example 1 with S3DataStore

use of org.apache.jackrabbit.oak.blob.cloud.s3.S3DataStore in project jackrabbit-oak by apache.

the class DataStoreUtils method configureIfCloudDataStore.

public static DataStore configureIfCloudDataStore(String className, DataStore ds, Map<String, ?> config, String bucket, StatisticsProvider statisticsProvider) throws Exception {
    // Add bucket info
    Properties props = new Properties();
    props.putAll(config);
    log.info("Using bucket [ {} ]", bucket);
    if (isS3DataStore(className)) {
        props.setProperty(S3Constants.S3_BUCKET, bucket);
        // Set the props object
        if (S3.getName().equals(className)) {
            ((S3DataStore) ds).setProperties(props);
            ((S3DataStore) ds).setStatisticsProvider(statisticsProvider);
        } else if (JR2_S3.getName().equals(className)) {
            ((org.apache.jackrabbit.oak.blob.cloud.aws.s3.SharedS3DataStore) ds).setProperties(props);
        }
    } else if (isAzureDataStore(className)) {
        props.setProperty(AzureConstants.AZURE_BLOB_CONTAINER_NAME, bucket);
        ((AzureDataStore) ds).setProperties(props);
        ((AzureDataStore) ds).setStatisticsProvider(statisticsProvider);
    }
    return ds;
}
Also used : S3DataStore(org.apache.jackrabbit.oak.blob.cloud.s3.S3DataStore) SharedS3DataStore(org.apache.jackrabbit.oak.blob.cloud.aws.s3.SharedS3DataStore) Properties(java.util.Properties)

Aggregations

Properties (java.util.Properties)1 SharedS3DataStore (org.apache.jackrabbit.oak.blob.cloud.aws.s3.SharedS3DataStore)1 S3DataStore (org.apache.jackrabbit.oak.blob.cloud.s3.S3DataStore)1