jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chet...@apache.org
Subject svn commit: r1581717 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/blob/datastore: FileDataStoreService.java OakFileDataStore.java
Date Wed, 26 Mar 2014 07:55:07 GMT
Author: chetanm
Date: Wed Mar 26 07:55:07 2014
New Revision: 1581717

URL: http://svn.apache.org/r1581717
Log:
OAK-1604 - Support for signed references in Blob

Adding OakFileDataStore to enable providing the signingKey via OSGi config

Added:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/blob/datastore/OakFileDataStore.java
      - copied, changed from r1581716, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/blob/datastore/FileDataStoreService.java
Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/blob/datastore/FileDataStoreService.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/blob/datastore/FileDataStoreService.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/blob/datastore/FileDataStoreService.java?rev=1581717&r1=1581716&r2=1581717&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/blob/datastore/FileDataStoreService.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/blob/datastore/FileDataStoreService.java
Wed Mar 26 07:55:07 2014
@@ -24,7 +24,6 @@ import java.util.Map;
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.ConfigurationPolicy;
 import org.apache.jackrabbit.core.data.DataStore;
-import org.apache.jackrabbit.core.data.FileDataStore;
 import org.osgi.service.component.ComponentContext;
 
 @Component(policy = ConfigurationPolicy.REQUIRE, name=FileDataStoreService.NAME)
@@ -33,6 +32,6 @@ public class FileDataStoreService extend
 
     @Override
     protected DataStore createDataStore(ComponentContext context, Map<String, Object>
config) {
-        return new FileDataStore();
+        return new OakFileDataStore();
     }
 }

Copied: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/blob/datastore/OakFileDataStore.java
(from r1581716, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/blob/datastore/FileDataStoreService.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/blob/datastore/OakFileDataStore.java?p2=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/blob/datastore/OakFileDataStore.java&p1=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/blob/datastore/FileDataStoreService.java&r1=1581716&r2=1581717&rev=1581717&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/blob/datastore/FileDataStoreService.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/blob/datastore/OakFileDataStore.java
Wed Mar 26 07:55:07 2014
@@ -19,20 +19,29 @@
 
 package org.apache.jackrabbit.oak.plugins.blob.datastore;
 
-import java.util.Map;
-
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.ConfigurationPolicy;
-import org.apache.jackrabbit.core.data.DataStore;
+import com.google.common.io.BaseEncoding;
+import org.apache.jackrabbit.core.data.DataStoreException;
 import org.apache.jackrabbit.core.data.FileDataStore;
-import org.osgi.service.component.ComponentContext;
 
-@Component(policy = ConfigurationPolicy.REQUIRE, name=FileDataStoreService.NAME)
-public class FileDataStoreService extends AbstractDataStoreService{
-    public static final String NAME = "org.apache.jackrabbit.oak.plugins.blob.datastore.FileDataStore";
+/**
+ *  Oak specific extension of JR2 FileDataStore which enables
+ *  provisioning the signing key via OSGi config
+ */
+public class OakFileDataStore extends FileDataStore {
+    private byte[] signingKey;
 
     @Override
-    protected DataStore createDataStore(ComponentContext context, Map<String, Object>
config) {
-        return new FileDataStore();
+    protected byte[] getOrCreateReferenceKey() throws DataStoreException {
+        if(signingKey != null){
+            return signingKey;
+        }
+        return super.getOrCreateReferenceKey();
+    }
+
+    /**
+     * Set Base64 encoded signing key
+     */
+    public void setSigningKey(String encodedKey) {
+        this.signingKey = BaseEncoding.base64().decode(encodedKey);
     }
 }



Mime
View raw message