diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..0a3e299ac596dc61a1624d7ae29562298475729f --- /dev/null +++ b/.gitignore @@ -0,0 +1,63 @@ +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.ear +*.zip +*.tar.gz +*.rar +*.db +rebel.xml + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +#Directories +target/ +build/ +tmp/ +bin/ +logs/ +GitDirectory/ + + +#Windows +Thumbs.db +Desktop.ini + +#Eclipse +*.pydevproject +.project +.metadata +*.tmp +*.bak +*.swp +*~.nib +local.properties +.classpath +.settings/ +.loadpath + +#IntelliJ IDEA +*.iml +\.idea/ + +#Sonar-Scanner +\.scannerwork/ + +# Thumbnails +._* + +*# Testing environment specific +derby.log diff --git a/common/pom.xml b/common/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..40be8acf553f5873b0c554e26a988b0d562f448c --- /dev/null +++ b/common/pom.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>vis-java</artifactId> + <groupId>cz.jezek</groupId> + <version>0.0.1-SNAPSHOT</version> + </parent> + + <artifactId>common</artifactId> + + <name>common</name> + <!-- FIXME change it to the project's website --> + <url>http://www.example.com</url> + + <properties> + </properties> + + <dependencies> + </dependencies> + +</project> diff --git a/common/src/main/java/cz/common/Person.java b/common/src/main/java/cz/common/Person.java new file mode 100644 index 0000000000000000000000000000000000000000..87097490357f38a83cfb54433d7b69f80757b1de --- /dev/null +++ b/common/src/main/java/cz/common/Person.java @@ -0,0 +1,34 @@ +package cz.common; + +public class Person { + private String name; + private long id; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public Person(long id, String name) { + super(); + this.id = id; + this.name = name; + } + + @Override + public String toString() { + return "Person [id=" + id + ", name=" + name + "]"; + } + +} diff --git a/common/src/main/java/module-info.java b/common/src/main/java/module-info.java new file mode 100644 index 0000000000000000000000000000000000000000..307a39fea7f2e7bc0a3b524c468609a9781c79f4 --- /dev/null +++ b/common/src/main/java/module-info.java @@ -0,0 +1,3 @@ +module common { + exports cz.common; +} \ No newline at end of file diff --git a/common/src/test/java/cz/common/PersonTest.java b/common/src/test/java/cz/common/PersonTest.java new file mode 100644 index 0000000000000000000000000000000000000000..dfc8895523bf506e5443effff551eb043bc999e3 --- /dev/null +++ b/common/src/test/java/cz/common/PersonTest.java @@ -0,0 +1,18 @@ +package cz.common; + +import static org.junit.jupiter.api.Assertions.assertNotNull; + +import org.junit.jupiter.api.Test; + +/** + * Unit test for simple App. + */ +public class PersonTest { + /** + * Rigorous Test :-) + */ + @Test + public void toStringTest() { + assertNotNull(new Person(1, "Test").toString()); + } +} diff --git a/dataLayerDB/pom.xml b/dataLayerDB/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..a6ba1579f10cb8fe0cfd0944875f7f73c7cec20a --- /dev/null +++ b/dataLayerDB/pom.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>vis-java</artifactId> + <groupId>cz.jezek</groupId> + <version>0.0.1-SNAPSHOT</version> + </parent> + + <artifactId>dataLayerDB</artifactId> + + <name>dataLayerDB</name> + <!-- FIXME change it to the project's website --> + <url>http://www.example.com</url> + + <properties> + </properties> + + <dependencies> + <dependency> + <groupId>cz.jezek</groupId> + <artifactId>dataLayerInterfaces</artifactId> + <version>0.0.1-SNAPSHOT</version> + </dependency> + </dependencies> + +</project> diff --git a/dataLayerDB/src/main/java/cz/dataLayerDB/PersonDM.java b/dataLayerDB/src/main/java/cz/dataLayerDB/PersonDM.java new file mode 100644 index 0000000000000000000000000000000000000000..f67262f9e7f4b14a582e30a421b32f9dfe4dc891 --- /dev/null +++ b/dataLayerDB/src/main/java/cz/dataLayerDB/PersonDM.java @@ -0,0 +1,16 @@ +package cz.dataLayerDB; + +import java.util.Arrays; +import java.util.List; + +import cz.common.Person; +import cz.dataLayerInterfaces.PersonDataMapperInterface; + +public class PersonDM implements PersonDataMapperInterface{ + + @Override + public List<Person> getAllPersons() { + return Arrays.asList(new Person(1, "SQL Modul")); + } + +} diff --git a/dataLayerDB/src/main/java/module-info.java b/dataLayerDB/src/main/java/module-info.java new file mode 100644 index 0000000000000000000000000000000000000000..b0cd2d38b0283d8aa394c645a34404ab191d450b --- /dev/null +++ b/dataLayerDB/src/main/java/module-info.java @@ -0,0 +1,10 @@ +import cz.dataLayerDB.PersonDM; +import cz.dataLayerInterfaces.PersonDataMapperInterface; + +module dataLayerDB { + exports cz.dataLayerDB; + + requires transitive common; + requires dataLayerInterfaces; + provides PersonDataMapperInterface with PersonDM; +} \ No newline at end of file diff --git a/dataLayerDB/src/test/java/cz/dataLayerDB/PersonDMTest.java b/dataLayerDB/src/test/java/cz/dataLayerDB/PersonDMTest.java new file mode 100644 index 0000000000000000000000000000000000000000..b7f6540cf0f530dcb15e90098bc7bbb8203d85e1 --- /dev/null +++ b/dataLayerDB/src/test/java/cz/dataLayerDB/PersonDMTest.java @@ -0,0 +1,21 @@ +package cz.dataLayerDB; + + +import static org.junit.jupiter.api.Assertions.assertFalse; + +import org.junit.jupiter.api.Test; + +/** + * Unit test for simple App. + */ +public class PersonDMTest +{ + /** + * Rigorous Test :-) + */ + @Test + public void getAllPersonsTest() + { + assertFalse(new PersonDM().getAllPersons().isEmpty()); + } +} diff --git a/dataLayerInterfaces/pom.xml b/dataLayerInterfaces/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..5124bdc86b0c26d8eb3b0f3bbfe57390e08a8f17 --- /dev/null +++ b/dataLayerInterfaces/pom.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>vis-java</artifactId> + <groupId>cz.jezek</groupId> + <version>0.0.1-SNAPSHOT</version> + </parent> + + <artifactId>dataLayerInterfaces</artifactId> + + <name>dataLayerInterfaces</name> + <!-- FIXME change it to the project's website --> + <url>http://www.example.com</url> + + <properties> + </properties> + + <dependencies> + <dependency> + <groupId>cz.jezek</groupId> + <artifactId>common</artifactId> + <version>0.0.1-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.reflections</groupId> + <artifactId>reflections</artifactId> + <version>0.9.12</version> + </dependency> + </dependencies> + +</project> diff --git a/dataLayerInterfaces/src/main/java/cz/dataLayerInterfaces/PersonDataMapperInterface.java b/dataLayerInterfaces/src/main/java/cz/dataLayerInterfaces/PersonDataMapperInterface.java new file mode 100644 index 0000000000000000000000000000000000000000..ed1e43df032812adfde3eb500972878da48da88a --- /dev/null +++ b/dataLayerInterfaces/src/main/java/cz/dataLayerInterfaces/PersonDataMapperInterface.java @@ -0,0 +1,47 @@ +package cz.dataLayerInterfaces; + +import java.util.List; +import java.util.ServiceLoader; + +import org.reflections.Reflections; +import org.reflections.scanners.SubTypesScanner; + +import cz.common.Person; + +public interface PersonDataMapperInterface { + + public List<Person> getAllPersons(); + + public static PersonDataMapperInterface newInstance() { + ServiceLoader<PersonDataMapperInterface> service = ServiceLoader.load(PersonDataMapperInterface.class); + for (PersonDataMapperInterface personDataMapperInterface : service) { + System.out.println("Implementation of PersonDataMapperInterface found: " + + personDataMapperInterface.getClass().getCanonicalName()); + } + for (PersonDataMapperInterface inter : service) { + return inter; + } + /* + * try find implementation using reflection, due running without module support + * to run spring + */ + return findImplementationByReflection(); + + } + + public static PersonDataMapperInterface findImplementationByReflection() { + String packageNameForSearch = "cz"; + Reflections reflections = new Reflections(packageNameForSearch, new SubTypesScanner()); + Class<?> clazz = reflections.getSubTypesOf(PersonDataMapperInterface.class).stream().findAny().orElse(null); + if (clazz == null) { + return null; + } + try { + return (PersonDataMapperInterface) clazz.getConstructor(null).newInstance(null); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + return null; + } + +} diff --git a/dataLayerInterfaces/src/main/java/module-info.java b/dataLayerInterfaces/src/main/java/module-info.java new file mode 100644 index 0000000000000000000000000000000000000000..b48e7c095248ae1ac965acab28676e76d22d69a5 --- /dev/null +++ b/dataLayerInterfaces/src/main/java/module-info.java @@ -0,0 +1,9 @@ +import cz.dataLayerInterfaces.PersonDataMapperInterface; + +module dataLayerInterfaces { + exports cz.dataLayerInterfaces; + + requires transitive common; + requires reflections; + uses PersonDataMapperInterface; +} \ No newline at end of file diff --git a/dataLayerOther/pom.xml b/dataLayerOther/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..7873689a100f1ef735ef7015f52ce7faf866d082 --- /dev/null +++ b/dataLayerOther/pom.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>vis-java</artifactId> + <groupId>cz.jezek</groupId> + <version>0.0.1-SNAPSHOT</version> + </parent> + + <artifactId>dataLayerOther</artifactId> + + <name>dataLayerOther</name> + <!-- FIXME change it to the project's website --> + <url>http://www.example.com</url> + + <properties> + </properties> + + <dependencies> + <dependency> + <groupId>cz.jezek</groupId> + <artifactId>dataLayerInterfaces</artifactId> + <version>0.0.1-SNAPSHOT</version> + </dependency> + </dependencies> + +</project> diff --git a/dataLayerOther/src/main/java/cz/dataLayerOther/PersonOtherDM.java b/dataLayerOther/src/main/java/cz/dataLayerOther/PersonOtherDM.java new file mode 100644 index 0000000000000000000000000000000000000000..c45853e046745a2a5746bd687ba646e1bdd70918 --- /dev/null +++ b/dataLayerOther/src/main/java/cz/dataLayerOther/PersonOtherDM.java @@ -0,0 +1,16 @@ +package cz.dataLayerOther; + +import java.util.Arrays; +import java.util.List; + +import cz.common.Person; +import cz.dataLayerInterfaces.PersonDataMapperInterface; + +public class PersonOtherDM implements PersonDataMapperInterface{ + + @Override + public List<Person> getAllPersons() { + return Arrays.asList(new Person(1, "Other storage Modul")); + } + +} diff --git a/dataLayerOther/src/main/java/module-info.java b/dataLayerOther/src/main/java/module-info.java new file mode 100644 index 0000000000000000000000000000000000000000..8437317daef9f77841f287d52a7e0ba215feddf0 --- /dev/null +++ b/dataLayerOther/src/main/java/module-info.java @@ -0,0 +1,10 @@ +import cz.dataLayerInterfaces.PersonDataMapperInterface; +import cz.dataLayerOther.PersonOtherDM; + +module dataLayerOther { + exports cz.dataLayerOther; + + requires transitive common; + requires dataLayerInterfaces; + provides PersonDataMapperInterface with PersonOtherDM; +} \ No newline at end of file diff --git a/dataLayerOther/src/test/java/cz/dataLayerOther/PersonOtherDMTest.java b/dataLayerOther/src/test/java/cz/dataLayerOther/PersonOtherDMTest.java new file mode 100644 index 0000000000000000000000000000000000000000..5cf9f3805f1b370b2a7b0d64096c8c17f0c3075e --- /dev/null +++ b/dataLayerOther/src/test/java/cz/dataLayerOther/PersonOtherDMTest.java @@ -0,0 +1,21 @@ +package cz.dataLayerOther; + + +import static org.junit.jupiter.api.Assertions.assertFalse; + +import org.junit.jupiter.api.Test; + +/** + * Unit test for simple App. + */ +public class PersonOtherDMTest +{ + /** + * Rigorous Test :-) + */ + @Test + public void getAllPersonsTest() + { + assertFalse(new PersonOtherDM().getAllPersons().isEmpty()); + } +} diff --git a/domainLayer/pom.xml b/domainLayer/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..a966ea2f761508e3b3ed4a1b732985f157e839f7 --- /dev/null +++ b/domainLayer/pom.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>vis-java</artifactId> + <groupId>cz.jezek</groupId> + <version>0.0.1-SNAPSHOT</version> + </parent> + + <artifactId>domainLayer</artifactId> + + <name>domainLayer</name> + <!-- FIXME change it to the project's website --> + <url>http://www.example.com</url> + + <properties> + </properties> + + <dependencies> + <dependency> + <groupId>cz.jezek</groupId> + <artifactId>dataLayerInterfaces</artifactId> + <version>0.0.1-SNAPSHOT</version> + </dependency> + </dependencies> + +</project> diff --git a/domainLayer/src/main/java/cz/domainLayer/PersonTransactionScript.java b/domainLayer/src/main/java/cz/domainLayer/PersonTransactionScript.java new file mode 100644 index 0000000000000000000000000000000000000000..e775703e3de38605ce65af24ccb011be8ddd3a96 --- /dev/null +++ b/domainLayer/src/main/java/cz/domainLayer/PersonTransactionScript.java @@ -0,0 +1,23 @@ +package cz.domainLayer; + +import java.util.List; + +import cz.common.Person; +import cz.dataLayerInterfaces.PersonDataMapperInterface; + +public class PersonTransactionScript { + + private PersonDataMapperInterface personDM; + + + public PersonTransactionScript() { + personDM = PersonDataMapperInterface.newInstance(); + } + + + public List<Person> getAllPersons(){ + System.out.println("personDM="+personDM); + /*very complicated domain logic :-) */ + return personDM.getAllPersons(); + } +} diff --git a/domainLayer/src/main/java/module-info.java b/domainLayer/src/main/java/module-info.java new file mode 100644 index 0000000000000000000000000000000000000000..5c3491a1ef0453944e2d56faff7216aabc382f0c --- /dev/null +++ b/domainLayer/src/main/java/module-info.java @@ -0,0 +1,6 @@ +module domainLayer { + exports cz.domainLayer; + + requires transitive common ; + requires dataLayerInterfaces; +} \ No newline at end of file diff --git a/domainLayer/src/test/java/cz/domainLayer/PersonTransactionScriptTest.java b/domainLayer/src/test/java/cz/domainLayer/PersonTransactionScriptTest.java new file mode 100644 index 0000000000000000000000000000000000000000..b5db29fa4b55d7479e0a94400b11ed709547ace9 --- /dev/null +++ b/domainLayer/src/test/java/cz/domainLayer/PersonTransactionScriptTest.java @@ -0,0 +1,18 @@ +package cz.domainLayer; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.junit.jupiter.api.Test; + +/** + * Unit test for simple App. + */ +public class PersonTransactionScriptTest { + /** + * Rigorous Test :-) + */ + @Test + public void getAllPersonsTest() { + assertTrue(true); + } +} diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..b44a0ea3a56ed119b0f5a37f2433a391849a9341 --- /dev/null +++ b/pom.xml @@ -0,0 +1,138 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>cz.jezek</groupId> + <artifactId>vis-java</artifactId> + <version>0.0.1-SNAPSHOT</version> + <packaging>pom</packaging> + <name>vis-java</name> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <maven.compiler.source>14</maven.compiler.source> + <maven.compiler.target>14</maven.compiler.target> + </properties> + + <dependencies> + <!-- + https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api --> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter-api</artifactId> + <version>5.5.2</version> + <scope>test</scope> + </dependency> + <!-- + https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-engine --> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter-engine</artifactId> + <version>5.5.2</version> + <scope>test</scope> + </dependency> + <!-- + https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-params --> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter-params</artifactId> + <version>5.5.2</version> + <scope>test</scope> + </dependency> + </dependencies> + <build> + <pluginManagement><!-- lock down plugins versions to avoid using Maven + defaults (may be moved to parent pom) --> + <plugins> + <!-- clean lifecycle, see + https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle --> + <plugin> + <artifactId>maven-clean-plugin</artifactId> + <version>3.1.0</version> + </plugin> + <!-- default lifecycle, jar packaging: see + https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging --> + <plugin> + <artifactId>maven-resources-plugin</artifactId> + <version>3.0.2</version> + </plugin> + <plugin> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.8.0</version> + <configuration> + <release>14</release> + </configuration> + </plugin> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <version>3.0.0-M5</version> + </plugin> + <plugin> + <artifactId>maven-jar-plugin</artifactId> + <version>3.0.2</version> + </plugin> + <plugin> + <artifactId>maven-install-plugin</artifactId> + <version>2.5.2</version> + </plugin> + <plugin> + <artifactId>maven-deploy-plugin</artifactId> + <version>2.8.2</version> + </plugin> + <!-- site lifecycle, see + https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle --> + <plugin> + <artifactId>maven-site-plugin</artifactId> + <version>3.7.1</version> + </plugin> + <plugin> + <artifactId>maven-project-info-reports-plugin</artifactId> + <version>3.0.0</version> + </plugin> + <!-- Ignore/Execute plugin execution in Eclipse (error of m2e + eclipse plugin) --> + <plugin> + <groupId>org.eclipse.m2e</groupId> + <artifactId>lifecycle-mapping</artifactId> + <version>1.0.0</version> + <configuration> + <lifecycleMappingMetadata> + <pluginExecutions> + <!-- copy-dependency plugin --> + <pluginExecution> + <pluginExecutionFilter> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <versionRange>[1.0.0,)</versionRange> + <goals> + <goal>copy-dependencies</goal> + </goals> + </pluginExecutionFilter> + <action> + <ignore /> + </action> + </pluginExecution> + </pluginExecutions> + </lifecycleMappingMetadata> + </configuration> + </plugin> + + </plugins> + </pluginManagement> + </build> + <modules> + <module>common</module> + <module>domainLayer</module> + <module>dataLayerInterfaces</module> + <module>dataLayerDB</module> + <module>dataLayerOther</module> + <module>viewLayerJavaFX</module> + <module>viewLayerSpring</module> + <module>run-javaFX-DB</module> + <module>run-javaFX-OtherStorage</module> + <module>run-spring-DB</module> + <module>run-spring-OtherStorage</module> + </modules> +</project> diff --git a/run-javaFX-DB/compile-and-run.bat b/run-javaFX-DB/compile-and-run.bat new file mode 100644 index 0000000000000000000000000000000000000000..14e7a58f02f5d34309de7c79c9c0c14cdc56a63e --- /dev/null +++ b/run-javaFX-DB/compile-and-run.bat @@ -0,0 +1,3 @@ +cd .. +mvn clean install +java --module-path ./run-javaFX-DB/target/libs:./run-javaFX-DB/target/run-javaFX-DB-0.0.1-SNAPSHOT.jar -m runJavaFXDB/org.run.javaFX.DB.App \ No newline at end of file diff --git a/run-javaFX-DB/compile-and-run.sh b/run-javaFX-DB/compile-and-run.sh new file mode 100755 index 0000000000000000000000000000000000000000..5127710a64faa6da91346b4b4750cd32842ffa6b --- /dev/null +++ b/run-javaFX-DB/compile-and-run.sh @@ -0,0 +1,4 @@ +#!/bin/bash +cd .. +mvn clean install +java --module-path ./run-javaFX-DB/target/libs:./run-javaFX-DB/target/run-javaFX-DB-0.0.1-SNAPSHOT.jar -m runJavaFXDB/org.run.javaFX.DB.App diff --git a/run-javaFX-DB/pom.xml b/run-javaFX-DB/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..9a2042ac93c6e2ec3c96eb0e96e0f28827ce8882 --- /dev/null +++ b/run-javaFX-DB/pom.xml @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>vis-java</artifactId> + <groupId>cz.jezek</groupId> + <version>0.0.1-SNAPSHOT</version> + </parent> + + <artifactId>run-javaFX-DB</artifactId> + + <name>run-javaFX-DB</name> + <!-- FIXME change it to the project's website --> + <url>http://www.example.com</url> + + <properties> + </properties> + + <dependencies> + <dependency> + <groupId>cz.jezek</groupId> + <artifactId>viewLayerJavaFX</artifactId> + <version>0.0.1-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>cz.jezek</groupId> + <artifactId>dataLayerDB</artifactId> + <version>0.0.1-SNAPSHOT</version> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>copy-dependencies</id> + <phase>prepare-package</phase> + <goals> + <goal>copy-dependencies</goal> + </goals> + <configuration> + <outputDirectory> + ${project.build.directory}/libs + </outputDirectory> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <configuration> + <archive> + <manifest> + <addClasspath>true</addClasspath> + <classpathPrefix>libs/</classpathPrefix> + <mainClass> + org.run.javaFX.DB.App + </mainClass> + </manifest> + </archive> + </configuration> + </plugin> + </plugins> + + </build> +</project> diff --git a/run-javaFX-DB/src/main/java/cz/run/javaFX/DB/App.java b/run-javaFX-DB/src/main/java/cz/run/javaFX/DB/App.java new file mode 100644 index 0000000000000000000000000000000000000000..f86e8fb3b65b53bd80ab0e521ebecd8321cab4bb --- /dev/null +++ b/run-javaFX-DB/src/main/java/cz/run/javaFX/DB/App.java @@ -0,0 +1,13 @@ +package cz.run.javaFX.DB; + +/** + * Hello world! + * + */ +public class App +{ + public static void main( String[] args ) + { + cz.viewLayerJavaFX.App.main(args); + } +} diff --git a/run-javaFX-DB/src/main/java/module-info.java b/run-javaFX-DB/src/main/java/module-info.java new file mode 100644 index 0000000000000000000000000000000000000000..dcb1db7d32532a75a4ac2387fbfadb972033f1a4 --- /dev/null +++ b/run-javaFX-DB/src/main/java/module-info.java @@ -0,0 +1,5 @@ +module runJavaFXDB { + exports cz.run.javaFX.DB; + requires cz.jezek.viewLayerJavaFX; + requires domainLayer; +} \ No newline at end of file diff --git a/run-javaFX-DB/src/test/java/cz/run/javaFX/DB/AppTest.java b/run-javaFX-DB/src/test/java/cz/run/javaFX/DB/AppTest.java new file mode 100644 index 0000000000000000000000000000000000000000..155a30ef867a0648a066920ca8d4f08eb3cdc8ba --- /dev/null +++ b/run-javaFX-DB/src/test/java/cz/run/javaFX/DB/AppTest.java @@ -0,0 +1,18 @@ +package cz.run.javaFX.DB; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.junit.jupiter.api.Test; + +/** + * Unit test for simple App. + */ +public class AppTest { + /** + * Rigorous Test :-) + */ + @Test + public void getAllPersonsTest() { + assertTrue(true); + } +} diff --git a/run-javaFX-OtherStorage/compile-and-run.bat b/run-javaFX-OtherStorage/compile-and-run.bat new file mode 100644 index 0000000000000000000000000000000000000000..14e7a58f02f5d34309de7c79c9c0c14cdc56a63e --- /dev/null +++ b/run-javaFX-OtherStorage/compile-and-run.bat @@ -0,0 +1,3 @@ +cd .. +mvn clean install +java --module-path ./run-javaFX-DB/target/libs:./run-javaFX-DB/target/run-javaFX-DB-0.0.1-SNAPSHOT.jar -m runJavaFXDB/org.run.javaFX.DB.App \ No newline at end of file diff --git a/run-javaFX-OtherStorage/compile-and-run.sh b/run-javaFX-OtherStorage/compile-and-run.sh new file mode 100755 index 0000000000000000000000000000000000000000..d7205098d22283db85f243464dd5fe4018c57918 --- /dev/null +++ b/run-javaFX-OtherStorage/compile-and-run.sh @@ -0,0 +1,4 @@ +#!/bin/bash +cd .. +mvn clean install +java --module-path ./run-javaFX-OtherStorage/target/libs:./run-javaFX-OtherStorage/target/run-javaFX-OtherStorage-0.0.1-SNAPSHOT.jar -m runJavaFXOtherStorage/org.run.javaFX.OtherStorage.App diff --git a/run-javaFX-OtherStorage/pom.xml b/run-javaFX-OtherStorage/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..ad390a87bf57ee15862724f6891956a41ffc993f --- /dev/null +++ b/run-javaFX-OtherStorage/pom.xml @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>vis-java</artifactId> + <groupId>cz.jezek</groupId> + <version>0.0.1-SNAPSHOT</version> + </parent> + + <artifactId>run-javaFX-OtherStorage</artifactId> + + <name>run-javaFX-OtherStorage</name> + <!-- FIXME change it to the project's website --> + <url>http://www.example.com</url> + + <properties> + </properties> + + <dependencies> + <dependency> + <groupId>cz.jezek</groupId> + <artifactId>viewLayerJavaFX</artifactId> + <version>0.0.1-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>cz.jezek</groupId> + <artifactId>dataLayerOther</artifactId> + <version>0.0.1-SNAPSHOT</version> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>copy-dependencies</id> + <phase>prepare-package</phase> + <goals> + <goal>copy-dependencies</goal> + </goals> + <configuration> + <outputDirectory> + ${project.build.directory}/libs + </outputDirectory> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <configuration> + <archive> + <manifest> + <addClasspath>true</addClasspath> + <classpathPrefix>libs/</classpathPrefix> + <mainClass> + org.run.javaFX.OtherStorage.App + </mainClass> + </manifest> + </archive> + </configuration> + </plugin> + </plugins> + + </build> +</project> diff --git a/run-javaFX-OtherStorage/src/main/java/cz/run/javaFX/OtherStorage/App.java b/run-javaFX-OtherStorage/src/main/java/cz/run/javaFX/OtherStorage/App.java new file mode 100644 index 0000000000000000000000000000000000000000..87f2dfd9e4280808c4d9b5c40d92cc72d92e566f --- /dev/null +++ b/run-javaFX-OtherStorage/src/main/java/cz/run/javaFX/OtherStorage/App.java @@ -0,0 +1,13 @@ +package cz.run.javaFX.OtherStorage; + +/** + * Hello world! + * + */ +public class App +{ + public static void main( String[] args ) + { + cz.viewLayerJavaFX.App.main(args); + } +} diff --git a/run-javaFX-OtherStorage/src/main/java/module-info.java b/run-javaFX-OtherStorage/src/main/java/module-info.java new file mode 100644 index 0000000000000000000000000000000000000000..c9309ec11dae378d8f72fc42c35bac8d9d9ba1ce --- /dev/null +++ b/run-javaFX-OtherStorage/src/main/java/module-info.java @@ -0,0 +1,5 @@ +module runJavaFXOtherStorage { + exports cz.run.javaFX.OtherStorage; + requires cz.jezek.viewLayerJavaFX; + requires domainLayer; +} \ No newline at end of file diff --git a/run-javaFX-OtherStorage/src/test/java/cz/run/javaFX/DB/AppTest.java b/run-javaFX-OtherStorage/src/test/java/cz/run/javaFX/DB/AppTest.java new file mode 100644 index 0000000000000000000000000000000000000000..155a30ef867a0648a066920ca8d4f08eb3cdc8ba --- /dev/null +++ b/run-javaFX-OtherStorage/src/test/java/cz/run/javaFX/DB/AppTest.java @@ -0,0 +1,18 @@ +package cz.run.javaFX.DB; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.junit.jupiter.api.Test; + +/** + * Unit test for simple App. + */ +public class AppTest { + /** + * Rigorous Test :-) + */ + @Test + public void getAllPersonsTest() { + assertTrue(true); + } +} diff --git a/run-spring-DB/compile-and-run.bat b/run-spring-DB/compile-and-run.bat new file mode 100644 index 0000000000000000000000000000000000000000..da382329a49debec78f33213c733c4ca88a6b750 --- /dev/null +++ b/run-spring-DB/compile-and-run.bat @@ -0,0 +1,3 @@ +cd .. +mvn clean install +java -jar run-spring-DB/target/run-spring-DB-0.0.1-SNAPSHOT.jar diff --git a/run-spring-DB/compile-and-run.sh b/run-spring-DB/compile-and-run.sh new file mode 100755 index 0000000000000000000000000000000000000000..dbe9fac4eb98ec9a53c663a90721c8f2e4385763 --- /dev/null +++ b/run-spring-DB/compile-and-run.sh @@ -0,0 +1,4 @@ +#!/bin/bash +cd .. +mvn clean install +java -jar run-spring-DB/target/run-spring-DB-0.0.1-SNAPSHOT.jar diff --git a/run-spring-DB/pom.xml b/run-spring-DB/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..7498d818213b28e9e7456acfc96ae3ece3b77a58 --- /dev/null +++ b/run-spring-DB/pom.xml @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>vis-java</artifactId> + <groupId>cz.jezek</groupId> + <version>0.0.1-SNAPSHOT</version> + </parent> + + <artifactId>run-spring-DB</artifactId> + + <name>run-spring-DB</name> + <!-- FIXME change it to the project's website --> + <url>http://www.example.com</url> + + <properties> + </properties> + + <dependencies> + <dependency> + <groupId>cz.jezek</groupId> + <artifactId>dataLayerDB</artifactId> + <version>0.0.1-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>cz.jezek</groupId> + <artifactId>viewLayerSpring</artifactId> + <version>0.0.1-SNAPSHOT</version> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>copy-dependencies</id> + <phase>prepare-package</phase> + <goals> + <goal>copy-dependencies</goal> + </goals> + <configuration> + <outputDirectory> + ${project.build.directory}/libs + </outputDirectory> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <configuration> + <archive> + <manifest> + <addClasspath>true</addClasspath> + <classpathPrefix>libs/</classpathPrefix> + <mainClass> + cz.run.spring.DB.App + </mainClass> + </manifest> + </archive> + </configuration> + </plugin> + </plugins> + + </build> +</project> diff --git a/run-spring-DB/src/main/java/cz/run/spring/DB/App.java b/run-spring-DB/src/main/java/cz/run/spring/DB/App.java new file mode 100644 index 0000000000000000000000000000000000000000..2cbc3ec2ca4cc0c42a8854a27c2b37140d645c7c --- /dev/null +++ b/run-spring-DB/src/main/java/cz/run/spring/DB/App.java @@ -0,0 +1,13 @@ +package cz.run.spring.DB; + +import cz.jezek.demospring.DemoSpringApplication; + +/** + * Hello world! + * + */ +public class App { + public static void main(String[] args) { + DemoSpringApplication.main(args); + } +} diff --git a/run-spring-DB/src/test/java/cz/run/javaFX/DB/AppTest.java b/run-spring-DB/src/test/java/cz/run/javaFX/DB/AppTest.java new file mode 100644 index 0000000000000000000000000000000000000000..155a30ef867a0648a066920ca8d4f08eb3cdc8ba --- /dev/null +++ b/run-spring-DB/src/test/java/cz/run/javaFX/DB/AppTest.java @@ -0,0 +1,18 @@ +package cz.run.javaFX.DB; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.junit.jupiter.api.Test; + +/** + * Unit test for simple App. + */ +public class AppTest { + /** + * Rigorous Test :-) + */ + @Test + public void getAllPersonsTest() { + assertTrue(true); + } +} diff --git a/run-spring-OtherStorage/compile-and-run.bat b/run-spring-OtherStorage/compile-and-run.bat new file mode 100644 index 0000000000000000000000000000000000000000..3c97ba6cc44ad5f9fe5a00c877434512b8c45cab --- /dev/null +++ b/run-spring-OtherStorage/compile-and-run.bat @@ -0,0 +1,4 @@ +cd .. +mvn clean install + +java -jar run-spring-OtherStorage/target/run-spring-OtherStorage-0.0.1-SNAPSHOT.jar diff --git a/run-spring-OtherStorage/compile-and-run.sh b/run-spring-OtherStorage/compile-and-run.sh new file mode 100755 index 0000000000000000000000000000000000000000..7ca1c249048736c635af7b53052c7fb37fbd82ed --- /dev/null +++ b/run-spring-OtherStorage/compile-and-run.sh @@ -0,0 +1,4 @@ +#!/bin/bash +cd .. +mvn clean install +java -jar run-spring-OtherStorage/target/run-spring-OtherStorage-0.0.1-SNAPSHOT.jar diff --git a/run-spring-OtherStorage/pom.xml b/run-spring-OtherStorage/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..1e59f68eb14447d136c052fd7e388c1fc915b937 --- /dev/null +++ b/run-spring-OtherStorage/pom.xml @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>vis-java</artifactId> + <groupId>cz.jezek</groupId> + <version>0.0.1-SNAPSHOT</version> + </parent> + + <artifactId>run-spring-OtherStorage</artifactId> + + <name>run-spring-OtherStorage</name> + <!-- FIXME change it to the project's website --> + <url>http://www.example.com</url> + + <properties> + </properties> + + <dependencies> + <dependency> + <groupId>cz.jezek</groupId> + <artifactId>dataLayerOther</artifactId> + <version>0.0.1-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>cz.jezek</groupId> + <artifactId>viewLayerSpring</artifactId> + <version>0.0.1-SNAPSHOT</version> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>copy-dependencies</id> + <phase>prepare-package</phase> + <goals> + <goal>copy-dependencies</goal> + </goals> + <configuration> + <outputDirectory> + ${project.build.directory}/libs + </outputDirectory> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <configuration> + <archive> + <manifest> + <addClasspath>true</addClasspath> + <classpathPrefix>libs/</classpathPrefix> + <mainClass> + cz.run.spring.DB.App + </mainClass> + </manifest> + </archive> + </configuration> + </plugin> + </plugins> + + </build> +</project> diff --git a/run-spring-OtherStorage/src/main/java/cz/run/spring/DB/App.java b/run-spring-OtherStorage/src/main/java/cz/run/spring/DB/App.java new file mode 100644 index 0000000000000000000000000000000000000000..2cbc3ec2ca4cc0c42a8854a27c2b37140d645c7c --- /dev/null +++ b/run-spring-OtherStorage/src/main/java/cz/run/spring/DB/App.java @@ -0,0 +1,13 @@ +package cz.run.spring.DB; + +import cz.jezek.demospring.DemoSpringApplication; + +/** + * Hello world! + * + */ +public class App { + public static void main(String[] args) { + DemoSpringApplication.main(args); + } +} diff --git a/run-spring-OtherStorage/src/test/java/cz/run/javaFX/DB/AppTest.java b/run-spring-OtherStorage/src/test/java/cz/run/javaFX/DB/AppTest.java new file mode 100644 index 0000000000000000000000000000000000000000..155a30ef867a0648a066920ca8d4f08eb3cdc8ba --- /dev/null +++ b/run-spring-OtherStorage/src/test/java/cz/run/javaFX/DB/AppTest.java @@ -0,0 +1,18 @@ +package cz.run.javaFX.DB; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.junit.jupiter.api.Test; + +/** + * Unit test for simple App. + */ +public class AppTest { + /** + * Rigorous Test :-) + */ + @Test + public void getAllPersonsTest() { + assertTrue(true); + } +} diff --git a/viewLayerJavaFX/pom.xml b/viewLayerJavaFX/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..dc422d167d1f37ec89f95ee31e228d0b04a9963b --- /dev/null +++ b/viewLayerJavaFX/pom.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>vis-java</artifactId> + <groupId>cz.jezek</groupId> + <version>0.0.1-SNAPSHOT</version> + </parent> + + <artifactId>viewLayerJavaFX</artifactId> + + <packaging>jar</packaging> + + <properties> + </properties> + <dependencies> + <dependency> + <groupId>org.openjfx</groupId> + <artifactId>javafx-controls</artifactId> + <version>14</version> + </dependency> + <dependency> + <groupId>org.openjfx</groupId> + <artifactId>javafx-fxml</artifactId> + <version>14</version> + </dependency> + + <dependency> + <groupId>cz.jezek</groupId> + <artifactId>domainLayer</artifactId> + <version>0.0.1-SNAPSHOT</version> + </dependency> + </dependencies> +</project> diff --git a/viewLayerJavaFX/src/main/java/cz/viewLayerJavaFX/App.java b/viewLayerJavaFX/src/main/java/cz/viewLayerJavaFX/App.java new file mode 100644 index 0000000000000000000000000000000000000000..b623b6bdf5bee5d9b85faf0fad8cfe9364ad5ad3 --- /dev/null +++ b/viewLayerJavaFX/src/main/java/cz/viewLayerJavaFX/App.java @@ -0,0 +1,37 @@ +package cz.viewLayerJavaFX; + +import cz.common.Person; +import cz.domainLayer.PersonTransactionScript; +import javafx.application.Application; +import javafx.scene.Scene; +import javafx.scene.layout.BorderPane; +import javafx.stage.Stage; + + +/** + * JavaFX App + */ +public class App extends Application { + + private PersonTransactionScript personTS = new PersonTransactionScript(); + @Override + public void start(Stage primaryStage) { + try { + BorderPane root = new BorderPane(); + Scene scene = new Scene(root,400,400); + scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm()); + primaryStage.setScene(scene); + primaryStage.show(); + for (Person person : personTS.getAllPersons()) { + System.out.println(person); + } + } catch(Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + launch(); + } + +} \ No newline at end of file diff --git a/viewLayerJavaFX/src/main/java/module-info.java b/viewLayerJavaFX/src/main/java/module-info.java new file mode 100644 index 0000000000000000000000000000000000000000..c3751893376787214683ec8839122d9eba2565e8 --- /dev/null +++ b/viewLayerJavaFX/src/main/java/module-info.java @@ -0,0 +1,8 @@ +module cz.jezek.viewLayerJavaFX { + requires transitive javafx.controls; + requires javafx.fxml; + requires domainLayer; + requires common; + opens cz.viewLayerJavaFX to javafx.fxml; + exports cz.viewLayerJavaFX; +} \ No newline at end of file diff --git a/viewLayerJavaFX/src/main/resources/cz/viewLayerJavaFX/application.css b/viewLayerJavaFX/src/main/resources/cz/viewLayerJavaFX/application.css new file mode 100644 index 0000000000000000000000000000000000000000..83d6f3343843c65d5dfaf3fedb97b6494c19113d --- /dev/null +++ b/viewLayerJavaFX/src/main/resources/cz/viewLayerJavaFX/application.css @@ -0,0 +1 @@ +/* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */ \ No newline at end of file diff --git a/viewLayerSpring/.gitignore b/viewLayerSpring/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..549e00a2a96fa9d7c5dbc9859664a78d980158c2 --- /dev/null +++ b/viewLayerSpring/.gitignore @@ -0,0 +1,33 @@ +HELP.md +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ diff --git a/viewLayerSpring/.mvn/wrapper/MavenWrapperDownloader.java b/viewLayerSpring/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000000000000000000000000000000000000..e76d1f3241d38db9b28f05133823bbed1ad289ff --- /dev/null +++ b/viewLayerSpring/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,117 @@ +/* + * Copyright 2007-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import java.net.*; +import java.io.*; +import java.nio.channels.*; +import java.util.Properties; + +public class MavenWrapperDownloader { + + private static final String WRAPPER_VERSION = "0.5.6"; + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" + + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if(mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if(mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if(!outputFile.getParentFile().exists()) { + if(!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { + String username = System.getenv("MVNW_USERNAME"); + char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); + Authenticator.setDefault(new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(username, password); + } + }); + } + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/viewLayerSpring/.mvn/wrapper/maven-wrapper.jar b/viewLayerSpring/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..2cc7d4a55c0cd0092912bf49ae38b3a9e3fd0054 Binary files /dev/null and b/viewLayerSpring/.mvn/wrapper/maven-wrapper.jar differ diff --git a/viewLayerSpring/.mvn/wrapper/maven-wrapper.properties b/viewLayerSpring/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..642d572ce90e5085986bdd9c9204b9404f028084 --- /dev/null +++ b/viewLayerSpring/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,2 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar diff --git a/viewLayerSpring/mvnw b/viewLayerSpring/mvnw new file mode 100755 index 0000000000000000000000000000000000000000..a16b5431b4c3cab50323a3f558003fd0abd87dad --- /dev/null +++ b/viewLayerSpring/mvnw @@ -0,0 +1,310 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="`/usr/libexec/java_home`" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + fi + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + if $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=`cygpath --path --windows "$javaClass"` + fi + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/viewLayerSpring/mvnw.cmd b/viewLayerSpring/mvnw.cmd new file mode 100644 index 0000000000000000000000000000000000000000..c8d43372c986d97911cdc21bd87e0cbe3d83bdda --- /dev/null +++ b/viewLayerSpring/mvnw.cmd @@ -0,0 +1,182 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM https://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + +FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% diff --git a/viewLayerSpring/pom.xml b/viewLayerSpring/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..a3e924bc925d551a8ea8b7a70776babb3b9b26f9 --- /dev/null +++ b/viewLayerSpring/pom.xml @@ -0,0 +1,112 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-parent</artifactId> + <version>2.4.0</version> + <relativePath /> <!-- lookup parent from repository --> + </parent> + <groupId>cz.jezek</groupId> + <artifactId>viewLayerSpring</artifactId> + <version>0.0.1-SNAPSHOT</version> + <name>viewLayerSpring</name> + <description>Demo project for Spring Boot</description> + + <properties> + <java.version>14</java.version> + </properties> + + <dependencies> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-thymeleaf</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-web</artifactId> + </dependency> + + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>cz.jezek</groupId> + <artifactId>domainLayer</artifactId> + <version>0.0.1-SNAPSHOT</version> + </dependency> + <!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api --> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter-api</artifactId> + <scope>test</scope> + </dependency> + <!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-engine --> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter-engine</artifactId> + <scope>test</scope> + </dependency> + <!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-params --> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter-params</artifactId> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <pluginManagement><!-- lock down plugins versions to avoid using Maven + defaults (may be moved to parent pom) --> + <plugins> + <!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle --> + <plugin> + <artifactId>maven-clean-plugin</artifactId> + <version>3.1.0</version> + </plugin> + <!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging --> + <plugin> + <artifactId>maven-resources-plugin</artifactId> + <version>3.0.2</version> + </plugin> + <plugin> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.8.0</version> + <configuration> + <release>14</release> + </configuration> + </plugin> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <version>3.0.0-M5</version> + </plugin> + <plugin> + <artifactId>maven-jar-plugin</artifactId> + <version>3.0.2</version> + </plugin> + <plugin> + <artifactId>maven-install-plugin</artifactId> + <version>2.5.2</version> + </plugin> + <plugin> + <artifactId>maven-deploy-plugin</artifactId> + <version>2.8.2</version> + </plugin> + <!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle --> + <plugin> + <artifactId>maven-site-plugin</artifactId> + <version>3.7.1</version> + </plugin> + <plugin> + <artifactId>maven-project-info-reports-plugin</artifactId> + <version>3.0.0</version> + </plugin> + </plugins> + </pluginManagement> + </build> + +</project> diff --git a/viewLayerSpring/src/main/java/cz/jezek/demospring/DemoSpringApplication.java b/viewLayerSpring/src/main/java/cz/jezek/demospring/DemoSpringApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..847bb6dfc446bc3b5280c950d48ea70655f0d706 --- /dev/null +++ b/viewLayerSpring/src/main/java/cz/jezek/demospring/DemoSpringApplication.java @@ -0,0 +1,13 @@ +package cz.jezek.demospring; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class DemoSpringApplication { + + public static void main(String[] args) { + SpringApplication.run(DemoSpringApplication.class, args); + } + +} diff --git a/viewLayerSpring/src/main/java/cz/jezek/demospring/controllers/DemoController.java b/viewLayerSpring/src/main/java/cz/jezek/demospring/controllers/DemoController.java new file mode 100644 index 0000000000000000000000000000000000000000..2a7f67cb502f466a869596a597e3412ce6031fed --- /dev/null +++ b/viewLayerSpring/src/main/java/cz/jezek/demospring/controllers/DemoController.java @@ -0,0 +1,45 @@ +package cz.jezek.demospring.controllers; + +import java.util.List; + +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.context.annotation.SessionScope; + +import cz.common.Person; +import cz.domainLayer.PersonTransactionScript; + +@Controller +@SessionScope +public class DemoController { + + private PersonTransactionScript personTS = new PersonTransactionScript(); + + @GetMapping("/") + public String index(Model model){ + model.addAttribute("name", "David"); + return "index"; + } + + @GetMapping("/edit/{id}") + public String edit(@PathVariable(name = "id") int id, Model model){ + Person person = personTS.getAllPersons().stream().filter(p -> p.getId() == id).findAny().orElse(null); + model.addAttribute("person", person); + return "edit"; + } + + @GetMapping("/save") + public String save(@ModelAttribute Person person, Model model){ + //TODO + return "index"; + } + + @ModelAttribute(name = "persons") + public List<Person> getPersons(){ + return personTS.getAllPersons(); + } + +} diff --git a/viewLayerSpring/src/main/resources/application.yaml b/viewLayerSpring/src/main/resources/application.yaml new file mode 100644 index 0000000000000000000000000000000000000000..c4382e6adf1be58cd83e0cb3e755405aada29294 --- /dev/null +++ b/viewLayerSpring/src/main/resources/application.yaml @@ -0,0 +1,9 @@ +spring: + thymeleaf: + cache: false + cacheable: false + mandatory-file-encoding: UTF-8 + http: + encoding: + charset: UTF-8 + enabled: true \ No newline at end of file diff --git a/viewLayerSpring/src/main/resources/static/test.css b/viewLayerSpring/src/main/resources/static/test.css new file mode 100644 index 0000000000000000000000000000000000000000..703d0180c8c7ab1ada05c91242312ec3009ba148 --- /dev/null +++ b/viewLayerSpring/src/main/resources/static/test.css @@ -0,0 +1,3 @@ +.red-text { + color: red; +} \ No newline at end of file diff --git a/viewLayerSpring/src/main/resources/templates/edit.html b/viewLayerSpring/src/main/resources/templates/edit.html new file mode 100644 index 0000000000000000000000000000000000000000..cd2f5c74e582c3067002b9e6603d8ab4e78cf3e3 --- /dev/null +++ b/viewLayerSpring/src/main/resources/templates/edit.html @@ -0,0 +1,20 @@ +<!DOCTYPE html> + +<html xmlns:th="http://www.thymeleaf.org"> + + <head> + <title>Good Thymes Virtual Grocery</title> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> + </head> + + <body> + <form th:action="@{/save}" action="/save" th:object="${person}"> + Id:<input type="text" th:value="*{id}" value="1" disabled="true"/><br/> + <input type="hidden" th:field="*{id}"> + Name:<input type="text" th:field="*{name}" value="David"/><br/> + <input type="submit" value="Save"/> + </form> + </body> + +</html> + diff --git a/viewLayerSpring/src/main/resources/templates/index.html b/viewLayerSpring/src/main/resources/templates/index.html new file mode 100644 index 0000000000000000000000000000000000000000..4e0497c3387de520fc8a90b136ae10c38530d46a --- /dev/null +++ b/viewLayerSpring/src/main/resources/templates/index.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> + +<html xmlns:th="http://www.thymeleaf.org"> + +<head> +<title>Good Thymes Virtual Grocery</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<link rel="stylesheet" href="test.css" /> +</head> + +<body> + <p> + Ahoj jak se máš <span class="red-text" th:text="${name}">Pepa</span> + </p> + + <table> + <tr> + <th>Id</th> + <th>Jmeno</th> + <th>Vek</th> + </tr> + <tr th:each="person, iter :${persons}"> + <td th:text="${person.id}">Id</td> + <td th:text="${person.name}">Jmeno</td> + <td><form th:action="@{/edit/{id}(id=${person.id})}" + action="/edit/1"> + <input type="submit" value="Edit" /> + </form></td> + </tr> + </table> +</body> + +</html> + diff --git a/viewLayerSpring/src/test/java/cz/jezek/demospring/DemoSpringApplicationTests.java b/viewLayerSpring/src/test/java/cz/jezek/demospring/DemoSpringApplicationTests.java new file mode 100644 index 0000000000000000000000000000000000000000..c90e6c34553de644dfa353858a49822369bf41e6 --- /dev/null +++ b/viewLayerSpring/src/test/java/cz/jezek/demospring/DemoSpringApplicationTests.java @@ -0,0 +1,14 @@ +package cz.jezek.demospring; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.junit.jupiter.api.Test; + +class DemoSpringApplicationTests { + + @Test + void contextLoads() { + assertTrue(true); + } + +}