Skip to content

Commit 962c18c

Browse files
committed
XCOMMONS-3250: Make as easy as possible for various features to use an object store
* Fix since versions and component metadata. * Remove duplicate instance caching from S3 blob store manager.
1 parent 3f049e1 commit 962c18c

File tree

8 files changed

+22
-12
lines changed

8 files changed

+22
-12
lines changed

xwiki-commons-core/xwiki-commons-store/xwiki-commons-store-blob/xwiki-commons-store-blob-api/src/main/java/org/xwiki/store/blob/BlobPath.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
* interpret them as needed (e.g. S3 keys).
3434
*
3535
* @version $Id$
36-
* @since 17.7.0RC
36+
* @since 17.7.0RC1
3737
*/
3838
@Unstable
3939
public final class BlobPath

xwiki-commons-core/xwiki-commons-store/xwiki-commons-store-blob/xwiki-commons-store-blob-api/src/main/java/org/xwiki/store/blob/internal/BlobStoreConfiguration.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
import jakarta.inject.Inject;
2323
import jakarta.inject.Named;
24+
import jakarta.inject.Singleton;
2425

2526
import org.xwiki.component.annotation.Component;
2627
import org.xwiki.configuration.ConfigurationSource;
@@ -29,8 +30,10 @@
2930
* Configuration for the Blob Store.
3031
*
3132
* @version $Id$
33+
* @since 17.7.0RC1
3234
*/
33-
@Component
35+
@Component(roles = BlobStoreConfiguration.class)
36+
@Singleton
3437
public class BlobStoreConfiguration
3538
{
3639
@Inject

xwiki-commons-core/xwiki-commons-store/xwiki-commons-store-blob/xwiki-commons-store-blob-api/src/main/java/org/xwiki/store/blob/internal/DefaultBlobStoreManager.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,24 @@
2323
import java.util.concurrent.ConcurrentHashMap;
2424

2525
import jakarta.inject.Inject;
26+
import jakarta.inject.Singleton;
2627

28+
import org.xwiki.component.annotation.Component;
2729
import org.xwiki.component.manager.ComponentLookupException;
2830
import org.xwiki.component.manager.ComponentManager;
2931
import org.xwiki.store.blob.BlobStore;
3032
import org.xwiki.store.blob.BlobStoreException;
3133
import org.xwiki.store.blob.BlobStoreManager;
3234

35+
/**
36+
* Default implementation of {@link BlobStoreManager} that retrieves blob stores based on the name and the
37+
* configured store hint.
38+
*
39+
* @version $Id$
40+
* @since 17.7.0RC1
41+
*/
42+
@Component
43+
@Singleton
3344
public class DefaultBlobStoreManager implements BlobStoreManager
3445
{
3546
@Inject
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
org.xwiki.store.blob.internal.BlobStoreConfiguration
2+
org.xwiki.store.blob.internal.DefaultBlobStoreManager

xwiki-commons-core/xwiki-commons-store/xwiki-commons-store-blob/xwiki-commons-store-blob-filesystem/src/main/java/org/xwiki/store/blob/internal/FileSystemBlobStore.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
* A {@link BlobStore} implementation that stores blobs in the file system.
4141
*
4242
* @version $Id$
43+
* @since 17.7.0RC1
4344
*/
4445
public class FileSystemBlobStore implements BlobStore
4546
{
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
org.xwiki.store.blob.internal.FileSystemBlobStoreManager

xwiki-commons-core/xwiki-commons-store/xwiki-commons-store-blob/xwiki-commons-store-blob-s3/src/main/java/org/xwiki/store/blob/internal/S3BlobStoreManager.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919
*/
2020
package org.xwiki.store.blob.internal;
2121

22-
import java.util.concurrent.ConcurrentHashMap;
23-
import java.util.concurrent.ConcurrentMap;
24-
2522
import jakarta.inject.Inject;
2623
import jakarta.inject.Named;
2724
import jakarta.inject.Singleton;
@@ -60,8 +57,6 @@ public class S3BlobStoreManager implements BlobStoreManager, Initializable
6057
@Inject
6158
private S3ClientManager clientManager;
6259

63-
private final ConcurrentMap<String, S3BlobStore> stores = new ConcurrentHashMap<>();
64-
6560
private String bucketName;
6661

6762
@Override
@@ -84,11 +79,6 @@ public void initialize() throws InitializationException
8479

8580
@Override
8681
public BlobStore getBlobStore(String name) throws BlobStoreException
87-
{
88-
return this.stores.computeIfAbsent(name, this::createBlobStore);
89-
}
90-
91-
private S3BlobStore createBlobStore(String name)
9282
{
9383
String keyPrefix = this.configuration.getS3KeyPrefix();
9484
if (StringUtils.isNotBlank(keyPrefix) && !StringUtils.isNotBlank(name)) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
org.xwiki.store.blob.internal.S3BlobStoreManager
2+
org.xwiki.store.blob.internal.S3ClientManager

0 commit comments

Comments
 (0)