diff --git a/src/main/java/ru/molokoin/sourceListener/SourceListener.java b/src/main/java/ru/molokoin/sourceListener/SourceListener.java index efe630d..32a9e40 100644 --- a/src/main/java/ru/molokoin/sourceListener/SourceListener.java +++ b/src/main/java/ru/molokoin/sourceListener/SourceListener.java @@ -14,9 +14,15 @@ import java.util.Enumeration; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; +import org.eclipse.jgit.api.Git; +import org.eclipse.jgit.api.GitCommand; +import org.eclipse.jgit.events.RepositoryListener; +import org.eclipse.jgit.lib.Repository; + import com.fasterxml.jackson.core.exc.StreamReadException; import com.fasterxml.jackson.databind.DatabindException; import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.deser.impl.ExternalTypeHandler.Builder; public class SourceListener { public Options opt; @@ -36,7 +42,31 @@ public class SourceListener { } } /** - * + * Метод запускает бесконечный цикл проверки обновлений в репозитарии. + */ + public void live(){ + // + } + /** + * Метод проверяет, поступили ли обновления в репозитарий + * @return + */ + public boolean isUpdated(){ + // + //Repository repository = Git.lsRemoteRepository().setRemote(opt.getLinkVC()).getRepository(); + //git remote add + //Git.lsRemoteRepository() + + try { + System.out.println(Git.lsRemoteRepository().); + } catch (IOException e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + } + return true; + } + /** + * Извлечение данных из options.json * @return * @throws StreamReadException * @throws DatabindException @@ -52,7 +82,7 @@ public class SourceListener { return opt; } /** - * извлечение данных архива + * распаковка архива */ public void extract()throws IOException{ //считываем настройки извлечения @@ -85,9 +115,7 @@ public class SourceListener { .build(); try { HttpResponse response = client.send(request, - HttpResponse.BodyHandlers - .ofFileDownload(Path.of(opt.getDownloadPath()), StandardOpenOption.CREATE, StandardOpenOption.WRITE)); - + HttpResponse.BodyHandlers.ofFileDownload(Path.of(opt.getDownloadPath()), StandardOpenOption.CREATE, StandardOpenOption.WRITE)); System.out.println(response.statusCode()); System.out.println(response.headers()); Path path = response.body(); @@ -105,5 +133,6 @@ public class SourceListener { } catch (IOException e) { System.out.println(e.getMessage()); } + ear.isUpdated(); } }