package com.cadrlife.devsearch.agent.service;
import com.cadrlife.devsearch.agent.UpdateScope;
import com.cadrlife.devsearch.domain.Project;
import javax.inject.Inject;
import javax.inject.Named;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.nio.file.Path;
public class SourcePullService {
private static final Logger LOG = LoggerFactory.getLogger(SourcePullService.class);
private final Path checkoutRootPath;
private ListeningExecutorService executorService;
@Inject
public SourcePullService(@Named("checkout.root") Path checkoutRootPath, ListeningExecutorService executorService) {
this.checkoutRootPath = checkoutRootPath;
this.executorService = executorService;
}
public Iterable<ListenableFuture<Project>> pullRepo(RepoService repoService, UpdateScope updateScope) {
repoService.setCheckoutRootPath(checkoutRootPath);
repoService.setExecutorService(executorService);
return repoService.pullRepo(updateScope);
}
}