mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-17 02:31:14 +01:00
Use static method for new StoreParameters instance
This commit is contained in:
@@ -39,11 +39,12 @@ import com.google.inject.Singleton;
|
||||
|
||||
import sonia.scm.group.Group;
|
||||
import sonia.scm.group.GroupDAO;
|
||||
import sonia.scm.store.StoreParameters;
|
||||
import sonia.scm.xml.AbstractXmlDAO;
|
||||
|
||||
import sonia.scm.store.ConfigurationStoreFactory;
|
||||
|
||||
import static sonia.scm.store.StoreParameters.forType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
@@ -66,10 +67,10 @@ public class XmlGroupDAO extends AbstractXmlDAO<Group, XmlGroupDatabase>
|
||||
*/
|
||||
@Inject
|
||||
public XmlGroupDAO(ConfigurationStoreFactory storeFactory) {
|
||||
super(storeFactory.getStore(new StoreParameters()
|
||||
.withType(XmlGroupDatabase.class)
|
||||
.withName(STORE_NAME)
|
||||
.build()));
|
||||
super(storeFactory.getStore(
|
||||
forType(XmlGroupDatabase.class)
|
||||
.withName(STORE_NAME)
|
||||
.build()));
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
@@ -73,10 +73,10 @@ public abstract class FileBasedStoreFactory {
|
||||
protected File getStoreLocation(String name, Class type, Repository repository) {
|
||||
if (storeDirectory == null) {
|
||||
if (repository != null) {
|
||||
LOG.debug("create store with type :{}, name:{} and repository {}", type, name, repository.getNamespaceAndName());
|
||||
LOG.debug("create store with type: {}, name: {} and repository: {}", type, name, repository.getNamespaceAndName());
|
||||
storeDirectory = this.getStoreDirectory(store, repository);
|
||||
} else {
|
||||
LOG.debug("create store with type :{} and name:{} ", type, name);
|
||||
LOG.debug("create store with type: {} and name: {} ", type, name);
|
||||
storeDirectory = this.getStoreDirectory(store);
|
||||
}
|
||||
IOUtil.mkdirs(storeDirectory);
|
||||
@@ -91,7 +91,7 @@ public abstract class FileBasedStoreFactory {
|
||||
* @return the store directory of a specific repository
|
||||
*/
|
||||
private File getStoreDirectory(Store store, Repository repository) {
|
||||
return new File (repositoryLocationResolver.getPath(repository.getId()).toFile(), store.getRepositoryStoreDirectory());
|
||||
return new File(repositoryLocationResolver.getPath(repository.getId()).toFile(), store.getRepositoryStoreDirectory());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -36,12 +36,12 @@ package sonia.scm.user.xml;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Singleton;
|
||||
|
||||
import sonia.scm.store.StoreParameters;
|
||||
import sonia.scm.store.ConfigurationStoreFactory;
|
||||
import sonia.scm.user.User;
|
||||
import sonia.scm.user.UserDAO;
|
||||
import sonia.scm.xml.AbstractXmlDAO;
|
||||
import sonia.scm.store.ConfigurationStoreFactory;
|
||||
|
||||
import static sonia.scm.store.StoreParameters.forType;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -66,10 +66,10 @@ public class XmlUserDAO extends AbstractXmlDAO<User, XmlUserDatabase>
|
||||
@Inject
|
||||
public XmlUserDAO(ConfigurationStoreFactory storeFactory)
|
||||
{
|
||||
super(storeFactory.getStore(new StoreParameters()
|
||||
.withType(XmlUserDatabase.class)
|
||||
.withName(STORE_NAME)
|
||||
.build()));
|
||||
super(storeFactory.getStore(
|
||||
forType(XmlUserDatabase.class)
|
||||
.withName(STORE_NAME)
|
||||
.build()));
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user