add the interface StoreFactory and refactor storeFactories

This commit is contained in:
Mohamed Karray
2018-11-27 11:35:02 +01:00
parent 39e5c19251
commit 7a1de0f67b
42 changed files with 485 additions and 291 deletions

View File

@@ -35,8 +35,10 @@ package sonia.scm.web.lfs;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import sonia.scm.repository.Repository;
import sonia.scm.store.Blob;
import sonia.scm.store.BlobStore;
import sonia.scm.store.BlobStoreFactory;
import sonia.scm.store.StoreParameters;
/**
* Creates {@link BlobStore} objects to store lfs objects.
@@ -74,7 +76,13 @@ public class LfsBlobStoreFactory {
*
* @return blob store for the corresponding scm repository
*/
@SuppressWarnings("unchecked")
public BlobStore getLfsBlobStore(Repository repository) {
return blobStoreFactory.getBlobStore(repository.getId() + GIT_LFS_REPOSITORY_POSTFIX);
return blobStoreFactory.getStore(new StoreParameters()
.withType(Blob.class)
.withName(repository.getId() + GIT_LFS_REPOSITORY_POSTFIX)
.forRepository(repository)
.build()
);
}
}