jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chet...@apache.org
Subject svn commit: r1577475 - /jackrabbit/trunk/jackrabbit-aws-ext/src/main/java/org/apache/jackrabbit/aws/ext/ds/S3Backend.java
Date Fri, 14 Mar 2014 10:33:49 GMT
Author: chetanm
Date: Fri Mar 14 10:33:48 2014
New Revision: 1577475

URL: http://svn.apache.org/r1577475
Log:
JCR-3748 - Allow configuring S3Backend programatically

Added an overloaded method which takes Properties instance

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=1577475&r1=1577474&r2=1577475&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
Fri Mar 14 10:33:48 2014
@@ -18,6 +18,7 @@
 package org.apache.jackrabbit.aws.ext.ds;
 
 import java.io.File;
+import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -109,12 +110,25 @@ public class S3Backend implements Backen
         if (config == null) {
             config = Utils.DEFAULT_CONFIG_FILE;
         }
+        Properties properties = null;
+        try{
+            properties = Utils.readConfig(config);
+        }catch(IOException e){
+            throw new DataStoreException("Could not initialize S3 from "
+                    + config, e);
+        }
+        init(store, homeDir, properties);
+    }
+
+    public void init(CachingDataStore store, String homeDir, Properties prop)
+            throws DataStoreException {
+
         ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
         try {
             startTime = new Date();
             Thread.currentThread().setContextClassLoader(
                 getClass().getClassLoader());
-            prop = Utils.readConfig(config);
+            this.prop = prop;
             if (LOG.isDebugEnabled()) {
                 LOG.debug("init");
             }
@@ -187,7 +201,7 @@ public class S3Backend implements Backen
                 LOG.debug("  error ", e);
             }
             throw new DataStoreException("Could not initialize S3 from "
-                + config, e);
+                + prop, e);
         } finally {
             if (contextClassLoader != null) {
                 Thread.currentThread().setContextClassLoader(contextClassLoader);



Mime
View raw message