jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chet...@apache.org
Subject svn commit: r1601550 - /jackrabbit/trunk/jackrabbit-aws-ext/src/main/java/org/apache/jackrabbit/aws/ext/ds/S3Backend.java
Date Tue, 10 Jun 2014 06:06:21 GMT
Author: chetanm
Date: Tue Jun 10 06:06:21 2014
New Revision: 1601550

URL: http://svn.apache.org/r1601550
Log:
JCR-3788 - S3DataStore require to set endpoint for thirdparty cloud provider (IDCF)

Applied the patch from Shashank.  The region would now be specified before bucket exist call
is made

Modified:
    jackrabbit/trunk/jackrabbit-aws-ext/src/main/java/org/apache/jackrabbit/aws/ext/ds/S3Backend.java

Modified: jackrabbit/trunk/jackrabbit-aws-ext/src/main/java/org/apache/jackrabbit/aws/ext/ds/S3Backend.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-aws-ext/src/main/java/org/apache/jackrabbit/aws/ext/ds/S3Backend.java?rev=1601550&r1=1601549&r2=1601550&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-aws-ext/src/main/java/org/apache/jackrabbit/aws/ext/ds/S3Backend.java
(original)
+++ jackrabbit/trunk/jackrabbit-aws-ext/src/main/java/org/apache/jackrabbit/aws/ext/ds/S3Backend.java
Tue Jun 10 06:06:21 2014
@@ -146,30 +146,19 @@ public class S3Backend implements Backen
                 bucket = prop.getProperty(S3Constants.S3_BUCKET);
             }
             String region = prop.getProperty(S3Constants.S3_REGION);
+            Region s3Region = null;
             String endpoint = null;
-            if (!s3service.doesBucketExist(bucket)) {
-
-                if (DEFAULT_AWS_BUCKET_REGION.equals(region)) {
-                    s3service.createBucket(bucket, Region.US_Standard);
-                    endpoint = S3 + DOT + AWSDOTCOM;
-                } else if (Region.EU_Ireland.toString().equals(region)) {
-                    s3service.createBucket(bucket, Region.EU_Ireland);
-                    endpoint = "s3-eu-west-1" + DOT + AWSDOTCOM;
-                } else {
-                    s3service.createBucket(bucket, region);
-                    endpoint = S3 + DASH + region + DOT + AWSDOTCOM;
-                }
-                LOG.info("Created bucket [{}] in [{}] ", bucket, region);
+            if (DEFAULT_AWS_BUCKET_REGION.equals(region)) {
+                s3Region =  Region.US_Standard;
+                endpoint = S3 + DOT + AWSDOTCOM;
+            } else if (Region.EU_Ireland.toString().equals(region)) {
+                s3Region = Region.EU_Ireland;
+                endpoint = "s3-eu-west-1" + DOT + AWSDOTCOM;
             } else {
-                LOG.info("Using bucket [{}]", bucket);
-                if (DEFAULT_AWS_BUCKET_REGION.equals(region)) {
-                    endpoint = S3 + DOT + AWSDOTCOM;
-                } else if (Region.EU_Ireland.toString().equals(region)) {
-                    endpoint = "s3-eu-west-1" + DOT + AWSDOTCOM;
-                } else {
-                    endpoint = S3 + DASH + region + DOT + AWSDOTCOM;
-                }
+                s3Region = Region.fromValue(region);
+                endpoint = S3 + DASH + region + DOT + AWSDOTCOM;
             }
+            
             String propEndPoint = prop.getProperty(S3Constants.S3_END_POINT);
             if (propEndPoint != null & !"".equals(propEndPoint)) {
                 endpoint = propEndPoint;
@@ -181,7 +170,12 @@ public class S3Backend implements Backen
              */
             s3service.setEndpoint(endpoint);
             LOG.info("S3 service endpoint [{}] ", endpoint);
-
+           
+            if (!s3service.doesBucketExist(bucket)) {
+                s3service.createBucket(bucket, s3Region);
+                LOG.info("Created bucket [{}] in [{}] ", bucket, region);
+            }
+           
             int writeThreads = 10;
             String writeThreadsStr = prop.getProperty(S3Constants.S3_WRITE_THREADS);
             if (writeThreadsStr != null) {



Mime
View raw message