You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by kw...@apache.org on 2026/10/12 10:14:31 UTC
(jackrabbit-filevault) 01/01: Upgrade maximum Oak/JR2 version to 2.6.0/2.22.5
This is an automated email from the ASF dual-hosted git repository.
kwin pushed a commit to branch feature/update-oak-2.6.0
in repository https://gitbox.apache.org/repos/asf/jackrabbit-filevault.git
commit e92e0ae9fa7e526656f1f29c8a0368d7ea0dd3d0
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Mon Oct 12 12:14:14 2026 +0200
Upgrade maximum Oak/JR2 version to 2.6.0/2.22.5
Optionally execute IT with minimum Oak version leveraging Maven
Toolchains.
Leverage Toolchains with Java 8 and Java 17 with GHA.
---
.github/workflows/build.yml | 14 +-
parent/pom.xml | 8 +-
vault-core-it/vault-core-it-execution/pom.xml | 2 +-
.../vault-core-it-execution-oak-max/pom.xml | 8 +
.../jackrabbit/vault/OakBlobStoreFactoryImpl.java | 44 +++++
.../vault-core-it-execution-oak-min/pom.xml | 205 ++++++++++++---------
.../jackrabbit/vault/OakBlobStoreFactoryImpl.java | 43 +++++
.../vault/it/JackrabbitRepositoryProvider.java | 3 +-
.../jackrabbit/vault/it/OakBlobStoreFactory.java | 29 +++
.../jackrabbit/vault/it/OakRepositoryProvider.java | 27 ++-
10 files changed, 279 insertions(+), 104 deletions(-)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index c0a0b140..0b8b8521 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -30,14 +30,19 @@ jobs:
name: ${{ matrix.namePrefix }} Maven build (${{ matrix.os }}, JDK ${{ matrix.jdk }})
strategy:
matrix:
- os: [ubuntu-latest]
- jdk: [17, 21, 25]
include:
+ # use multiple JDKs with toolchain (https://github.com/actions/setup-java#multiple-jdks-and-maven-toolchains)
+ - os: ubuntu-latest
+ jdk: |
+ 8
+ 17
# lengthy build steps should only be performed on linux with Java 21 (deployment)
- os: ubuntu-latest
jdk: 21
isMainBuildEnv: true
namePrefix: 'Main '
+ - os: ubuntu-latest
+ jdk: 25
# just build on latest LTS JDK with windows/mac os
- os: windows-latest
jdk: 25
@@ -77,6 +82,11 @@ jobs:
fi
echo "MVN_GOAL=install site" >> $GITHUB_ENV
fi
+ - name: Enable Oak min IT for JDK 8 toolchain
+ if: ${{ contains(matrix.jdk, '8') && contains(matrix.jdk, '17') }}
+ shell: bash
+ run: |
+ echo "MVN_ADDITIONAL_OPTS=${MVN_ADDITIONAL_OPTS:+$MVN_ADDITIONAL_OPTS }-Prun-oak-min-it -Dtoolchain-version=8" >> $GITHUB_ENV
- name: Build
env:
# secrets were provided in https://issues.apache.org/jira/browse/INFRA-27930?
diff --git a/parent/pom.xml b/parent/pom.xml
index 8471b728..71880297 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -94,12 +94,12 @@ Apache Jackrabbit FileVault is a project of the Apache Software Foundation.</des
<revision>4.2.1-SNAPSHOT</revision>
<!-- for dependencies used for calculating OSGi import-package version ranges the minimally supported version should be used to be backwards compatible in OSGi containers -->
<jackrabbit.min.version>2.20.17</jackrabbit.min.version>
- <!-- for embedded dependencies the newest version should be used -->
- <jackrabbit.max.version>2.22.1</jackrabbit.max.version>
+ <!-- for embedded dependencies the newest version should be used (also used for testing) -->
+ <jackrabbit.max.version>2.22.5</jackrabbit.max.version>
<!-- for dependencies used for calculating OSGi import-package version ranges the minimally supported version should be used to be backwards compatible in OSGi containers -->
<oak.min.version>1.22.4</oak.min.version>
- <!-- for embedded dependencies the newest version should be used -->
- <oak.max.version>1.82.0</oak.max.version>
+ <!-- only used for testing (and refererencing constant values which are inline at compile time) -->
+ <oak.max.version>2.6.0</oak.max.version>
<slf4j.version>1.7.25</slf4j.version>
<commons-io.version>2.18.0</commons-io.version>
<!-- passed to integration test as property "oak", set to true to test with Oak, false means test with Jackrabbit 2 -->
diff --git a/vault-core-it/vault-core-it-execution/pom.xml b/vault-core-it/vault-core-it-execution/pom.xml
index f2d49c2f..01e60561 100644
--- a/vault-core-it/vault-core-it-execution/pom.xml
+++ b/vault-core-it/vault-core-it-execution/pom.xml
@@ -131,6 +131,7 @@
<profiles>
<profile>
+ <id>run-oak-min-it</id>
<activation>
<jdk>[,14)</jdk>
</activation>
@@ -139,6 +140,5 @@
<module>vault-core-it-execution-oak-min</module>
</modules>
</profile>
-
</profiles>
</project>
diff --git a/vault-core-it/vault-core-it-execution/vault-core-it-execution-oak-max/pom.xml b/vault-core-it/vault-core-it-execution/vault-core-it-execution-oak-max/pom.xml
index eb1a62ca..a6c9c452 100644
--- a/vault-core-it/vault-core-it-execution/vault-core-it-execution-oak-max/pom.xml
+++ b/vault-core-it/vault-core-it-execution/vault-core-it-execution-oak-max/pom.xml
@@ -97,6 +97,14 @@
<version>${oak.max.version}</version>
<scope>test</scope>
</dependency>
+ <!-- http://metainf-services.kohsuke.org/index.html -->
+ <dependency>
+ <groupId>org.kohsuke.metainf-services</groupId>
+ <artifactId>metainf-services</artifactId>
+ <version>1.8</version>
+ <scope>provided</scope>
+ <optional>true</optional>
+ </dependency>
</dependencies>
<!-- ====================================================================== -->
diff --git a/vault-core-it/vault-core-it-execution/vault-core-it-execution-oak-max/src/test/java/org/apache/jackrabbit/vault/OakBlobStoreFactoryImpl.java b/vault-core-it/vault-core-it-execution/vault-core-it-execution-oak-max/src/test/java/org/apache/jackrabbit/vault/OakBlobStoreFactoryImpl.java
new file mode 100644
index 00000000..7ef84c64
--- /dev/null
+++ b/vault-core-it/vault-core-it-execution/vault-core-it-execution-oak-max/src/test/java/org/apache/jackrabbit/vault/OakBlobStoreFactoryImpl.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.jackrabbit.vault;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.jackrabbit.oak.plugins.blob.datastore.DataStoreBlobStore;
+import org.apache.jackrabbit.oak.spi.blob.BlobStore;
+import org.apache.jackrabbit.oak.spi.blob.data.FileDataStore;
+import org.apache.jackrabbit.vault.it.OakBlobStoreFactory;
+import org.kohsuke.MetaInfServices;
+
+@MetaInfServices
+public class OakBlobStoreFactoryImpl implements OakBlobStoreFactory {
+
+ @Override
+ public BlobStore createBlobStore(File oakRepoHomeDirectory, File oakBlobStoreDirectory) throws IOException {
+ oakBlobStoreDirectory.mkdirs();
+ // new package location since Oak 2.0.0 (https://issues.apache.org/jira/browse/OAK-8840)
+ FileDataStore fds = new FileDataStore();
+ fds.setMinRecordLength(4092);
+ fds.setPath(oakBlobStoreDirectory.getAbsolutePath());
+ fds.init(oakRepoHomeDirectory.getAbsolutePath());
+ // https://issues.apache.org/jira/browse/OAK-8840
+ return new DataStoreBlobStore(fds);
+ }
+}
diff --git a/vault-core-it/vault-core-it-execution/vault-core-it-execution-oak-min/pom.xml b/vault-core-it/vault-core-it-execution/vault-core-it-execution-oak-min/pom.xml
index 00e32bab..26ef5ebe 100644
--- a/vault-core-it/vault-core-it-execution/vault-core-it-execution-oak-min/pom.xml
+++ b/vault-core-it/vault-core-it-execution/vault-core-it-execution-oak-min/pom.xml
@@ -1,4 +1,5 @@
-<?xml version="1.0"?><!--
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
@@ -15,95 +16,127 @@
limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <!-- ====================================================================== -->
- <!-- P A R E N T P R O J E C T D E S C R I P T I O N -->
- <!-- ====================================================================== -->
- <parent>
- <groupId>org.apache.jackrabbit.vault</groupId>
- <artifactId>vault-core-it-execution</artifactId>
- <version>${revision}</version>
- </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <!-- ====================================================================== -->
+ <!-- P A R E N T P R O J E C T D E S C R I P T I O N -->
+ <!-- ====================================================================== -->
+ <parent>
+ <groupId>org.apache.jackrabbit.vault</groupId>
+ <artifactId>vault-core-it-execution</artifactId>
+ <version>${revision}</version>
+ </parent>
- <!-- ====================================================================== -->
- <!-- P R O J E C T D E S C R I P T I O N -->
- <!-- ====================================================================== -->
- <artifactId>vault-core-it-execution-oak-min</artifactId>
+ <!-- ====================================================================== -->
+ <!-- P R O J E C T D E S C R I P T I O N -->
+ <!-- ====================================================================== -->
+ <artifactId>vault-core-it-execution-oak-min</artifactId>
- <name>Apache Jackrabbit FileVault Core IT Execution Oak Minimum Version</name>
- <description>Executes Core ITs with minimally supported Oak version</description>
+ <name>Apache Jackrabbit FileVault Core IT Execution Oak Minimum Version</name>
+ <description>Executes Core ITs with minimally supported Oak version</description>
- <!-- ====================================================================== -->
- <!-- B U I L D -->
- <!-- ====================================================================== -->
- <build>
+ <!-- ====================================================================== -->
+ <!-- D E P E N D E N C I E S -->
+ <!-- ====================================================================== -->
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.jackrabbit.vault</groupId>
+ <artifactId>vault-core-it-support-oak</artifactId>
+ <version>${project.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jackrabbit</groupId>
+ <artifactId>oak-core</artifactId>
+ <version>${oak.min.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jackrabbit</groupId>
+ <artifactId>oak-core</artifactId>
+ <version>${oak.min.version}</version>
+ <classifier>tests</classifier>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jackrabbit</groupId>
+ <artifactId>jackrabbit-data</artifactId>
+ <version>2.20.1</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jackrabbit</groupId>
+ <artifactId>oak-jcr</artifactId>
+ <version>${oak.min.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jackrabbit</groupId>
+ <artifactId>oak-segment-tar</artifactId>
+ <version>${oak.min.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <!-- transitive artifactItem of oak-segment-tar, necessary for filedatastore (https://issues.apache.org/jira/browse/OAK-6542) -->
+ <dependency>
+ <groupId>io.dropwizard.metrics</groupId>
+ <artifactId>metrics-core</artifactId>
+ <version>3.2.3</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jackrabbit</groupId>
+ <artifactId>oak-authorization-principalbased</artifactId>
+ <version>${oak.min.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jackrabbit</groupId>
+ <artifactId>oak-authorization-cug</artifactId>
+ <version>${oak.min.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <!-- http://metainf-services.kohsuke.org/index.html -->
+ <dependency>
+ <groupId>org.kohsuke.metainf-services</groupId>
+ <artifactId>metainf-services</artifactId>
+ <version>1.8</version>
+ <scope>provided</scope>
+ <optional>true</optional>
+ </dependency>
+ </dependencies>
+
+ <!-- ====================================================================== -->
+ <!-- B U I L D -->
+ <!-- ====================================================================== -->
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <!-- allow running ITs with different JDK than the one of the Maven build (oak-min IT requires java < 14, while build requires >= 17) -->
+ <profile>
+ <id>use-toolchain</id>
+ <activation>
+ <property>
+ <name>toolchain-version</name>
+ </property>
+ </activation>
+ <build>
<plugins>
- <plugin>
- <artifactId>maven-failsafe-plugin</artifactId>
- </plugin>
+ <plugin>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <configuration>
+ <jdkToolchain>
+ <version>${toolchain-version}</version>
+ </jdkToolchain>
+ </configuration>
+ </plugin>
</plugins>
- </build>
-
- <!-- ====================================================================== -->
- <!-- D E P E N D E N C I E S -->
- <!-- ====================================================================== -->
- <dependencies>
- <dependency>
- <groupId>org.apache.jackrabbit.vault</groupId>
- <artifactId>vault-core-it-support-oak</artifactId>
- <version>${project.version}</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jackrabbit</groupId>
- <artifactId>oak-core</artifactId>
- <version>${oak.min.version}</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jackrabbit</groupId>
- <artifactId>oak-core</artifactId>
- <version>${oak.min.version}</version>
- <classifier>tests</classifier>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jackrabbit</groupId>
- <artifactId>jackrabbit-data</artifactId>
- <version>2.20.1</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jackrabbit</groupId>
- <artifactId>oak-jcr</artifactId>
- <version>${oak.min.version}</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jackrabbit</groupId>
- <artifactId>oak-segment-tar</artifactId>
- <version>${oak.min.version}</version>
- <scope>runtime</scope>
- </dependency>
- <!-- transitive artifactItem of oak-segment-tar, necessary for filedatastore (https://issues.apache.org/jira/browse/OAK-6542) -->
- <dependency>
- <groupId>io.dropwizard.metrics</groupId>
- <artifactId>metrics-core</artifactId>
- <version>3.2.3</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jackrabbit</groupId>
- <artifactId>oak-authorization-principalbased</artifactId>
- <version>${oak.min.version}</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jackrabbit</groupId>
- <artifactId>oak-authorization-cug</artifactId>
- <version>${oak.min.version}</version>
- <scope>runtime</scope>
- </dependency>
- </dependencies>
+ </build>
+ </profile>
+ </profiles>
</project>
diff --git a/vault-core-it/vault-core-it-execution/vault-core-it-execution-oak-min/src/test/java/org/apache/jackrabbit/vault/OakBlobStoreFactoryImpl.java b/vault-core-it/vault-core-it-execution/vault-core-it-execution-oak-min/src/test/java/org/apache/jackrabbit/vault/OakBlobStoreFactoryImpl.java
new file mode 100644
index 00000000..9ab7c8c2
--- /dev/null
+++ b/vault-core-it/vault-core-it-execution/vault-core-it-execution-oak-min/src/test/java/org/apache/jackrabbit/vault/OakBlobStoreFactoryImpl.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.jackrabbit.vault;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.jackrabbit.core.data.FileDataStore;
+import org.apache.jackrabbit.oak.plugins.blob.datastore.DataStoreBlobStore;
+import org.apache.jackrabbit.oak.spi.blob.BlobStore;
+import org.apache.jackrabbit.vault.it.OakBlobStoreFactory;
+import org.kohsuke.MetaInfServices;
+
+@MetaInfServices
+public class OakBlobStoreFactoryImpl implements OakBlobStoreFactory {
+
+ @Override
+ public BlobStore createBlobStore(File oakRepoHomeDirectory, File oakBlobStoreDirectory) throws IOException {
+ oakBlobStoreDirectory.mkdirs();
+ FileDataStore fds = new FileDataStore();
+ fds.setMinRecordLength(4092);
+ fds.setPath(oakBlobStoreDirectory.getAbsolutePath());
+ fds.init(oakRepoHomeDirectory.getAbsolutePath());
+ // https://issues.apache.org/jira/browse/OAK-8840
+ return new DataStoreBlobStore(fds);
+ }
+}
diff --git a/vault-core-it/vault-core-it-support/vault-core-it-support-jackrabbit/src/main/java/org/apache/jackrabbit/vault/it/JackrabbitRepositoryProvider.java b/vault-core-it/vault-core-it-support/vault-core-it-support-jackrabbit/src/main/java/org/apache/jackrabbit/vault/it/JackrabbitRepositoryProvider.java
index 12719972..22574b17 100644
--- a/vault-core-it/vault-core-it-support/vault-core-it-support-jackrabbit/src/main/java/org/apache/jackrabbit/vault/it/JackrabbitRepositoryProvider.java
+++ b/vault-core-it/vault-core-it-support/vault-core-it-support-jackrabbit/src/main/java/org/apache/jackrabbit/vault/it/JackrabbitRepositoryProvider.java
@@ -45,7 +45,8 @@ public class JackrabbitRepositoryProvider implements RepositoryProvider {
new File("target", "repository-jr2-" + System.getProperty("repoSuffix", "fork1"));
@Override
- public RepositoryWithMetadata createRepository(boolean arg0, boolean arg1, String... arg2)
+ public RepositoryWithMetadata createRepository(
+ boolean useFileStore, boolean enablePrincipalBasedAuthorization, String... cugEnabledPaths)
throws RepositoryException, IOException {
Repository repository;
try (InputStream in = JackrabbitRepositoryProvider.class.getResourceAsStream("/repository.xml")) {
diff --git a/vault-core-it/vault-core-it-support/vault-core-it-support-oak/src/main/java/org/apache/jackrabbit/vault/it/OakBlobStoreFactory.java b/vault-core-it/vault-core-it-support/vault-core-it-support-oak/src/main/java/org/apache/jackrabbit/vault/it/OakBlobStoreFactory.java
new file mode 100644
index 00000000..77569548
--- /dev/null
+++ b/vault-core-it/vault-core-it-support/vault-core-it-support-oak/src/main/java/org/apache/jackrabbit/vault/it/OakBlobStoreFactory.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.jackrabbit.vault.it;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.jackrabbit.oak.spi.blob.BlobStore;
+
+public interface OakBlobStoreFactory {
+
+ BlobStore createBlobStore(File oakRepoHomeDirectory, File oakBlobStoreDirectory) throws IOException;
+}
diff --git a/vault-core-it/vault-core-it-support/vault-core-it-support-oak/src/main/java/org/apache/jackrabbit/vault/it/OakRepositoryProvider.java b/vault-core-it/vault-core-it-support/vault-core-it-support-oak/src/main/java/org/apache/jackrabbit/vault/it/OakRepositoryProvider.java
index 89a5d452..23fd034e 100644
--- a/vault-core-it/vault-core-it-support/vault-core-it-support-oak/src/main/java/org/apache/jackrabbit/vault/it/OakRepositoryProvider.java
+++ b/vault-core-it/vault-core-it-support/vault-core-it-support-oak/src/main/java/org/apache/jackrabbit/vault/it/OakRepositoryProvider.java
@@ -26,16 +26,16 @@ import javax.jcr.SimpleCredentials;
import java.io.File;
import java.io.IOException;
import java.util.Collections;
+import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
+import java.util.ServiceLoader;
import java.util.concurrent.atomic.AtomicInteger;
import com.google.common.collect.ImmutableMap;
import org.apache.jackrabbit.commons.jackrabbit.authorization.AccessControlUtils;
-import org.apache.jackrabbit.core.data.FileDataStore;
import org.apache.jackrabbit.oak.commons.PathUtils;
import org.apache.jackrabbit.oak.jcr.Jcr;
-import org.apache.jackrabbit.oak.plugins.blob.datastore.DataStoreBlobStore;
import org.apache.jackrabbit.oak.plugins.tree.impl.RootProviderService;
import org.apache.jackrabbit.oak.plugins.tree.impl.TreeProviderService;
import org.apache.jackrabbit.oak.security.internal.SecurityProviderBuilder;
@@ -96,8 +96,8 @@ public class OakRepositoryProvider implements RepositoryProvider {
final Jcr jcr;
final FileStore fileStore;
if (useFileStore) {
- BlobStore blobStore = createBlobStore();
DIR_OAK_FILE_STORE.mkdirs();
+ BlobStore blobStore = getOakBlobStoreFactory().createBlobStore(DIR_OAK_REPO_HOME, DIR_OAK_BLOB_STORE);
try {
fileStore = FileStoreBuilder.fileStoreBuilder(DIR_OAK_FILE_STORE)
.withBlobStore(blobStore)
@@ -126,13 +126,20 @@ public class OakRepositoryProvider implements RepositoryProvider {
return new RepositoryWithMetadata(repository, Collections.singletonMap(KEY_FILESTORE, fileStore));
}
- private static BlobStore createBlobStore() throws IOException {
- DIR_OAK_BLOB_STORE.mkdirs();
- FileDataStore fds = new FileDataStore();
- fds.setMinRecordLength(4092);
- fds.setPath(DIR_OAK_BLOB_STORE.getAbsolutePath());
- fds.init(DIR_OAK_REPO_HOME.getAbsolutePath());
- return new DataStoreBlobStore(fds);
+ private OakBlobStoreFactory getOakBlobStoreFactory() {
+ Iterator<OakBlobStoreFactory> oakBlobStoreFactoryIterator = ServiceLoader.load(
+ OakBlobStoreFactory.class, this.getClass().getClassLoader())
+ .iterator();
+ if (!oakBlobStoreFactoryIterator.hasNext()) {
+ throw new IllegalStateException(
+ "Haven't found any service implementation of " + OakBlobStoreFactory.class.getName());
+ }
+ OakBlobStoreFactory oakBlobStoreFactory = oakBlobStoreFactoryIterator.next();
+ if (oakBlobStoreFactoryIterator.hasNext()) {
+ throw new IllegalStateException(
+ "Found more than one service implementation of " + OakBlobStoreFactory.class.getName());
+ }
+ return oakBlobStoreFactory;
}
private static ConfigurationParameters getSecurityConfigurationParameters() {