mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-02-04 13:49:13 +01:00
This is needed after migration from v1 to v2 and is done in GitV1UpdateStep.java. Therefore we hat to make the 'forAllPaths' method in PathBasedRepositoryLocationResolver available in the interface of RepositoryLocationResolver.
42 lines
1.1 KiB
Java
42 lines
1.1 KiB
Java
package sonia.scm;
|
|
|
|
import sonia.scm.repository.BasicRepositoryLocationResolver;
|
|
|
|
import java.io.File;
|
|
import java.nio.file.Path;
|
|
import java.util.function.BiConsumer;
|
|
|
|
public class TempDirRepositoryLocationResolver extends BasicRepositoryLocationResolver {
|
|
private final File tempDirectory;
|
|
|
|
public TempDirRepositoryLocationResolver(File tempDirectory) {
|
|
super(Path.class);
|
|
this.tempDirectory = tempDirectory;
|
|
}
|
|
|
|
@Override
|
|
protected <T> RepositoryLocationResolverInstance<T> create(Class<T> type) {
|
|
return new RepositoryLocationResolverInstance<T>() {
|
|
@Override
|
|
public T getLocation(String repositoryId) {
|
|
return (T) tempDirectory.toPath();
|
|
}
|
|
|
|
@Override
|
|
public T createLocation(String repositoryId) {
|
|
return (T) tempDirectory.toPath();
|
|
}
|
|
|
|
@Override
|
|
public void setLocation(String repositoryId, T location) {
|
|
throw new UnsupportedOperationException("not implemented for tests");
|
|
}
|
|
|
|
@Override
|
|
public void forAllLocations(BiConsumer<String, T> consumer) {
|
|
consumer.accept("id", (T) tempDirectory.toPath());
|
|
}
|
|
};
|
|
}
|
|
}
|