|
|
|
@ -14,9 +14,15 @@ import java.util.Enumeration;
@@ -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 {
@@ -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 <remote_name> <remote_uri>
|
|
|
|
|
//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 {
@@ -52,7 +82,7 @@ public class SourceListener {
|
|
|
|
|
return opt; |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* извлечение данных архива |
|
|
|
|
* распаковка архива |
|
|
|
|
*/ |
|
|
|
|
public void extract()throws IOException{ |
|
|
|
|
//считываем настройки извлечения
|
|
|
|
@ -85,9 +115,7 @@ public class SourceListener {
@@ -85,9 +115,7 @@ public class SourceListener {
|
|
|
|
|
.build(); |
|
|
|
|
try { |
|
|
|
|
HttpResponse<Path> 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 {
@@ -105,5 +133,6 @@ public class SourceListener {
|
|
|
|
|
} catch (IOException e) { |
|
|
|
|
System.out.println(e.getMessage()); |
|
|
|
|
} |
|
|
|
|
ear.isUpdated(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|