From 46133ad4c36b69e3c13ba034c6db044c2742c845 Mon Sep 17 00:00:00 2001 From: esoe Date: Thu, 10 Nov 2022 00:20:25 +0300 Subject: [PATCH] json-works --- options.json | 7 ++ .../molokoin/molokoin-client/css/style.css | 45 ++++++++++ out/unzip/molokoin/molokoin-client/index.html | 23 ++++++ out/unzip/molokoin/molokoin-client/js/main.js | 1 + .../zip/molokoin-client-master.zip | Bin pom.xml | 5 ++ .../ru/molokoin/sourceListener/Options.java | 42 ++++++++++ .../sourceListener/SourceListener.java | 78 +++++++++--------- .../ru/molokoin/sourceListener/Options.class | Bin 0 -> 1686 bytes .../sourceListener/SourceListener.class | Bin 5521 -> 5744 bytes 10 files changed, 162 insertions(+), 39 deletions(-) create mode 100644 options.json create mode 100644 out/unzip/molokoin/molokoin-client/css/style.css create mode 100644 out/unzip/molokoin/molokoin-client/index.html create mode 100644 out/unzip/molokoin/molokoin-client/js/main.js rename molokoin-client-master.zip => out/zip/molokoin-client-master.zip (100%) create mode 100644 src/main/java/ru/molokoin/sourceListener/Options.java create mode 100644 target/classes/ru/molokoin/sourceListener/Options.class diff --git a/options.json b/options.json new file mode 100644 index 0000000..290cefa --- /dev/null +++ b/options.json @@ -0,0 +1,7 @@ +{ + "linkVC" : "http://molokoin.ru:3000/esoe/molokoin-client/archive/master.zip", + "downloadPath" : "C:\\Users\\Strannik\\Documents\\esoe\\code\\sourceListener\\out\\zip", + "zipPath" : "C:\\Users\\Strannik\\Documents\\esoe\\code\\sourceListener\\out\\zip\\molokoin-client-master.zip", + "unzipPath" : "C:\\Users\\Strannik\\Documents\\esoe\\code\\sourceListener\\out\\unzip\\molokoin" + +} \ No newline at end of file diff --git a/out/unzip/molokoin/molokoin-client/css/style.css b/out/unzip/molokoin/molokoin-client/css/style.css new file mode 100644 index 0000000..50893ee --- /dev/null +++ b/out/unzip/molokoin/molokoin-client/css/style.css @@ -0,0 +1,45 @@ +body { + font-family: Arial; + padding: 20px; + background: #f1f1f1; +} +div { + background-color: rgb(181, 122, 236); + padding: 5px; + margin: 5px; +} +.header{ + display: block; + padding: 30px; + font-size: 40px; + text-align: center; + background: rgb(181, 122, 236); + /*position: relative; top: 20px;*/ +} +.controls{ + /*position: relative; left: 20px;*/ + list-style: none; /* Отключение отображения маркеров. */ + width: 25%; /* Ширина меню. */ + float: left; + /*padding-left: 20px;*/ +} +.controls li { + margin: 5px; /* Отступ между блоками по высоте, необходимый для того чтобы пункты меню не сливались */ + font-family: Verdana, Arial, Helvetica, sans-serif; /* Тип шрифта пунктов меню */ + font-size: 14px; /* Размер текста меню */ +} +.controls li a{ + display: block; /* Изменение отображения на блочное для того, чтобы иметь возможность задать внутренние отступы. */ + padding: 4px 15px; /* Отступы внутри блоков. */ + background: #0db5b5; /* Цвет блоков меню. */ + color: #3f3f3f; /* Цвет текста в блоках меню. */ + text-decoration: none; /* Устранение подчёркивания ссылок. */ + position: relative; /* Это необходимо при использовании Internet Explorer 6 для того, чтобы ссылка по всей своей площади была «кликабельной». */ +} +.controls li a:hover { + background: #92d3d3; /* Цвет фона при наведении курсора мыши */ + color: #6b6b6b; /* Цвет текста при наведении курсора мыши */ +} +.mainframe{ + background-color: aliceblue; +} \ No newline at end of file diff --git a/out/unzip/molokoin/molokoin-client/index.html b/out/unzip/molokoin/molokoin-client/index.html new file mode 100644 index 0000000..744949d --- /dev/null +++ b/out/unzip/molokoin/molokoin-client/index.html @@ -0,0 +1,23 @@ + + + + + + + molokoin.ru + + + +
+ molokoin.ru/ добавить картинку и кнопку авторизации +
+
+
  • gitea
  • +
  • apache
  • +
  • moodle
  • +
  • adminvps
  • + +
    + + + \ No newline at end of file diff --git a/out/unzip/molokoin/molokoin-client/js/main.js b/out/unzip/molokoin/molokoin-client/js/main.js new file mode 100644 index 0000000..1a90dbd --- /dev/null +++ b/out/unzip/molokoin/molokoin-client/js/main.js @@ -0,0 +1 @@ +console.log("qu") \ No newline at end of file diff --git a/molokoin-client-master.zip b/out/zip/molokoin-client-master.zip similarity index 100% rename from molokoin-client-master.zip rename to out/zip/molokoin-client-master.zip diff --git a/pom.xml b/pom.xml index a406b19..e1cbee1 100644 --- a/pom.xml +++ b/pom.xml @@ -23,6 +23,11 @@ 4.12 test + + com.fasterxml.jackson.core + jackson-databind + 2.14.0 + \ No newline at end of file diff --git a/src/main/java/ru/molokoin/sourceListener/Options.java b/src/main/java/ru/molokoin/sourceListener/Options.java new file mode 100644 index 0000000..08b5b1c --- /dev/null +++ b/src/main/java/ru/molokoin/sourceListener/Options.java @@ -0,0 +1,42 @@ +package ru.molokoin.sourceListener; + +public class Options { + private String linkVC; + private String downloadPath; + private String zipPath; + private String unzipPath; + + public Options(){} + public void setLinkVC(String linkVC) { + this.linkVC = linkVC; + } + public String getLinkVC() { + return linkVC; + } + public void setDownloadPath(String downloadPath) { + this.downloadPath = downloadPath; + } + public String getDownloadPath() { + return downloadPath; + } + public void setUnzipPath(String unzipPath) { + this.unzipPath = unzipPath; + } + public String getUnzipPath() { + return unzipPath; + } + public void setZipPath(String zipPath) { + this.zipPath = zipPath; + } + public String getZipPath() { + return zipPath; + } + @Override + public String toString() { + String s = "linkVC : " + getLinkVC() + "\n"; + s = s + "downloadPath : " + getDownloadPath() + "\n"; + s = s + "zipPath : " + getZipPath() + "\n"; + s = s + "unzipPath : " + getUnzipPath() + "\n"; + return s; + } +} diff --git a/src/main/java/ru/molokoin/sourceListener/SourceListener.java b/src/main/java/ru/molokoin/sourceListener/SourceListener.java index af97918..b816dfa 100644 --- a/src/main/java/ru/molokoin/sourceListener/SourceListener.java +++ b/src/main/java/ru/molokoin/sourceListener/SourceListener.java @@ -14,28 +14,53 @@ import java.util.Enumeration; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; +import com.fasterxml.jackson.core.exc.StreamReadException; +import com.fasterxml.jackson.databind.DatabindException; +import com.fasterxml.jackson.databind.ObjectMapper; public class SourceListener { - private URI link = URI.create("http://molokoin.ru:3000/esoe/molokoin-client/archive/master.zip"); - private Path downloadPath = Path.of(System.getProperty("user.dir")); - + public Options opt; + public SourceListener(){ + try { + opt = readOptions(); + } catch (StreamReadException e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + } catch (DatabindException e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + } catch (IOException e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + } + } + /** + * + * @return + * @throws StreamReadException + * @throws DatabindException + * @throws IOException + */ + public Options readOptions() throws StreamReadException, DatabindException, IOException{ + Options opt; + ObjectMapper mapper = new ObjectMapper(); + opt = mapper.readValue(new File("options.json"), Options.class); + return opt; + } + public Options getOpt() { + return opt; + } /** * извлечение данных архива */ public void extract()throws IOException{ - String fileZip = "C:\\Users\\devuser\\Documents\\code\\sourceListener\\molokoin-client-master.zip"; - File destDir = new File("src/main/resources/unzip"); - - try (ZipFile file = new ZipFile(fileZip)) - { + //считываем настройки извлечения + try (ZipFile file = new ZipFile(opt.getZipPath())){ Enumeration zipEntries = file.entries(); while (zipEntries.hasMoreElements()){ ZipEntry zipEntry = zipEntries.nextElement(); - File newFile = new File(destDir, zipEntry.getName()); - - //create sub directories + File newFile = new File(opt.getUnzipPath(), zipEntry.getName()); newFile.getParentFile().mkdirs(); - if (!zipEntry.isDirectory()){ try (FileOutputStream outputStream = new FileOutputStream(newFile)){ BufferedInputStream inputStream = new BufferedInputStream(file.getInputStream(zipEntry)); @@ -47,7 +72,6 @@ public class SourceListener { } } } - } /** * скачиваем архив проекта из системы контроля версий, @@ -56,12 +80,12 @@ public class SourceListener { public void download(){ HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() - .uri(getLink()) + .uri(URI.create(opt.getLinkVC())) .build(); try { HttpResponse response = client.send(request, HttpResponse.BodyHandlers - .ofFileDownload(getDownloadPath(), StandardOpenOption.CREATE, StandardOpenOption.WRITE)); + .ofFileDownload(Path.of(opt.getDownloadPath()), StandardOpenOption.CREATE, StandardOpenOption.WRITE)); System.out.println(response.statusCode()); System.out.println(response.headers()); @@ -71,30 +95,6 @@ public class SourceListener { System.out.println(e.getMessage()); } } - /** - * @param link the link to set - */ - public void setLink(URI link) { - this.link = link; - } - /** - * @return the link - */ - public URI getLink() { - return link; - } - /** - * @param downloadPath the downloadPath to set - */ - public void setDownloadPath(Path downloadPath) { - this.downloadPath = downloadPath; - } - /** - * @return the downloadPath - */ - public Path getDownloadPath() { - return downloadPath; - } public static void main(String[] args) { SourceListener ear = new SourceListener(); diff --git a/target/classes/ru/molokoin/sourceListener/Options.class b/target/classes/ru/molokoin/sourceListener/Options.class new file mode 100644 index 0000000000000000000000000000000000000000..f40080388baacb32e9633e3dfd38a0808555e40a GIT binary patch literal 1686 zcmai!Yg5xe6o%g|rD?+|Pzw|kEQrvHQt!w`R6x9S#2K_R_${Ro0wL+7DUR}|bVk9^ z8U5~$ay%!Aw3c-IvYYHVd-mD)yveWM-+lm?#d8G_feEKk+_z18&o-=L-EKHrddaA} zx}`hC^_pwgR$W06VEH#50u47o+3j(rgzq3qR ztG?9S9RcNoQS+Y?4eR7NwrE&}yCl$+&6NeBD|S^^(S@@TDtZKZONOPtXzW*X=ap75 zbw119(#*2v82lbAM%^8wE-+d8|7D0QQP*9n>!A;1PqXLB2?z{IbR$OD+s*7$Hg`Im zD5>CT%WZl4c?pHL_tN&(7zsn!um4KGsTU;@oGK~xBp{$t-Wy*u&blNK=PZ@7f@OiY zYx{yLm=+jnZ^LrKFsr%~M~?2{cPlfWQ89%A3!GA^?p28)q&?^?Z>A2?%z~0}X_WL71oj=BzPhMItjWKUAfj)YceggWD zq&Im*0AY<7ggO%fGSUu`3I!Pr2N`Pz86uE$2M}%!gHW?WK*riZMnXZx z!$Bt6K}HE=tOE$Ug+a)XAs`d&Aem4Q`m}=0KgpKtk;Ctp+DvATkHg%pu|(pjnDo7#BCXh literal 0 HcmV?d00001 diff --git a/target/classes/ru/molokoin/sourceListener/SourceListener.class b/target/classes/ru/molokoin/sourceListener/SourceListener.class index 4630a79ec47b8245b7d00e8fb0ec998ee5d99a41..f73638d573e3fbaf7d3c390193b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