├── 01-JavaBasics ├── .idea │ ├── .name │ ├── .gitignore │ ├── compiler.xml │ ├── vcs.xml │ ├── inspectionProfiles │ │ └── Project_Default.xml │ ├── codeStyles │ ├── jarRepositories.xml │ └── misc.xml ├── settings.gradle ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── src │ └── main │ │ └── java │ │ └── com │ │ └── scaler │ │ └── javabasics │ │ ├── Main.java │ │ ├── ExampleComDownloader.java │ │ └── MultiThreading.java ├── build.gradle ├── .gitignore ├── gradlew.bat └── gradlew ├── spring-sockets-1 ├── Procfile ├── system.properties ├── settings.gradle ├── src │ ├── main │ │ ├── resources │ │ │ ├── application.yaml │ │ │ └── static │ │ │ │ ├── music │ │ │ │ ├── music1.mp3 │ │ │ │ ├── music2.mp3 │ │ │ │ ├── music3.mp3 │ │ │ │ └── music4.mp3 │ │ │ │ ├── music.js │ │ │ │ └── index.html │ │ └── java │ │ │ └── com │ │ │ └── scaler │ │ │ └── springsockets1 │ │ │ ├── models │ │ │ └── PlayMessage.java │ │ │ ├── SpringSockets1Application.java │ │ │ ├── MusicPlayController.java │ │ │ └── WebSocketConfig.java │ └── test │ │ └── java │ │ └── com │ │ └── scaler │ │ └── springsockets1 │ │ └── SpringSockets1ApplicationTests.java ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── .gitignore ├── build.gradle ├── gradlew.bat └── gradlew ├── pc-builder ├── core │ ├── build.gradle │ └── src │ │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── scaler │ │ │ └── pcbuilder │ │ │ └── core │ │ │ ├── components │ │ │ ├── GPU.java │ │ │ ├── RAM.java │ │ │ ├── CPU.java │ │ │ ├── Storage.java │ │ │ ├── storage │ │ │ │ ├── HDD.java │ │ │ │ └── SSD.java │ │ │ ├── Cooler.java │ │ │ ├── cooler │ │ │ │ ├── CabinetFan.java │ │ │ │ └── LiquidAIO.java │ │ │ ├── cpu │ │ │ │ ├── AMDCPU.java │ │ │ │ └── IntelCPU.java │ │ │ ├── PSU.java │ │ │ ├── Cabinet.java │ │ │ └── MotherBoard.java │ │ │ ├── connectors │ │ │ ├── pci │ │ │ │ └── PCISlot.java │ │ │ ├── ram │ │ │ │ └── RAMChannels.java │ │ │ ├── storage │ │ │ │ └── StorageConnector.java │ │ │ └── cpu │ │ │ │ ├── AM4.java │ │ │ │ ├── LGA1200.java │ │ │ │ └── CPUSocket.java │ │ │ ├── peripherals │ │ │ ├── Peripheral.java │ │ │ ├── Mouse.java │ │ │ ├── Display.java │ │ │ ├── Keyboard.java │ │ │ ├── Printer.java │ │ │ └── Speakers.java │ │ │ ├── vendors │ │ │ ├── ChipVendor.java │ │ │ ├── BoardVendor.java │ │ │ └── Vendors.java │ │ │ ├── compatibility │ │ │ ├── FormFactor.java │ │ │ ├── PowerConsumer.java │ │ │ ├── PowerSupplier.java │ │ │ ├── FormFactors.java │ │ │ └── CompositePowerConsumer.java │ │ │ ├── systems │ │ │ ├── KVM.java │ │ │ └── Tower.java │ │ │ └── PC.java │ │ └── test │ │ └── java │ │ └── com │ │ └── scaler │ │ └── pcbuilder │ │ └── core │ │ ├── connectors │ │ └── cpu │ │ │ └── CPUSocketTests.java │ │ ├── PCBuilderTests.java │ │ └── systems │ │ └── TowerBuilderTests.java ├── settings.gradle ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── cli │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── scaler │ │ │ └── pcbuilder │ │ │ └── cli │ │ │ ├── PcBuilderApplication.java │ │ │ ├── config │ │ │ └── SpringShellConfig.java │ │ │ ├── shell │ │ │ ├── PCBuilderPromptProvider.java │ │ │ └── InputReader.java │ │ │ └── PCBuilderCLI.java │ └── build.gradle ├── .gitignore ├── build.gradle ├── gradlew.bat └── gradlew ├── springbasics ├── settings.gradle ├── src │ ├── main │ │ ├── resources │ │ │ └── application.properties │ │ └── java │ │ │ └── com │ │ │ └── scaler │ │ │ └── springbasics │ │ │ ├── hello │ │ │ └── HelloController.java │ │ │ └── SpringbasicsApplication.java │ └── test │ │ └── java │ │ └── com │ │ └── scaler │ │ └── springbasics │ │ └── SpringbasicsApplicationTests.java ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── build.gradle ├── .gitignore ├── gradlew.bat └── gradlew ├── springbasics-2 ├── settings.gradle ├── src │ ├── main │ │ ├── resources │ │ │ └── application.properties │ │ └── java │ │ │ └── com │ │ │ └── example │ │ │ └── springbasics2 │ │ │ ├── Springbasics2Application.java │ │ │ ├── HelloResponse.java │ │ │ └── HelloController.java │ └── test │ │ └── java │ │ └── com │ │ └── example │ │ └── springbasics2 │ │ └── Springbasics2ApplicationTests.java ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── .gitignore ├── build.gradle ├── gradlew.bat └── gradlew └── springjpa-basics-1 ├── settings.gradle ├── test.db.mv.db ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── src ├── main │ ├── java │ │ └── com │ │ │ └── example │ │ │ └── springjpabasics1 │ │ │ ├── tasks │ │ │ ├── TasksRepository.java │ │ │ ├── TaskEntity.java │ │ │ ├── TasksService.java │ │ │ └── TasksController.java │ │ │ ├── SpringjpaBasics1Application.java │ │ │ └── common │ │ │ └── ErrorResponse.java │ └── resources │ │ └── application.yaml └── test │ └── java │ └── com │ └── example │ └── springjpabasics1 │ └── SpringjpaBasics1ApplicationTests.java ├── .gitignore ├── build.gradle ├── gradlew.bat ├── gradlew └── test.db.trace.db /01-JavaBasics/.idea/.name: -------------------------------------------------------------------------------- 1 | javabasics -------------------------------------------------------------------------------- /spring-sockets-1/Procfile: -------------------------------------------------------------------------------- 1 | web: ./gradlew bootRun -------------------------------------------------------------------------------- /spring-sockets-1/system.properties: -------------------------------------------------------------------------------- 1 | java.runtime.version=11 -------------------------------------------------------------------------------- /pc-builder/core/build.gradle: -------------------------------------------------------------------------------- 1 | jar { 2 | enabled = true 3 | } -------------------------------------------------------------------------------- /springbasics/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'springbasics' 2 | -------------------------------------------------------------------------------- /01-JavaBasics/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'javabasics' 2 | 3 | -------------------------------------------------------------------------------- /springbasics-2/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'springbasics-2' 2 | -------------------------------------------------------------------------------- /spring-sockets-1/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'spring-sockets-1' 2 | -------------------------------------------------------------------------------- /springbasics-2/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=4545 2 | -------------------------------------------------------------------------------- /springbasics/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=4444 2 | -------------------------------------------------------------------------------- /springjpa-basics-1/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'springjpa-basics-1' 2 | -------------------------------------------------------------------------------- /spring-sockets-1/src/main/resources/application.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | port: ${PORT:4224} -------------------------------------------------------------------------------- /pc-builder/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'pc-builder' 2 | include 'core' 3 | include 'cli' 4 | 5 | -------------------------------------------------------------------------------- /springjpa-basics-1/test.db.mv.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scaleracademy/Oct-Nov-Dec-Projects/main/springjpa-basics-1/test.db.mv.db -------------------------------------------------------------------------------- /pc-builder/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scaleracademy/Oct-Nov-Dec-Projects/main/pc-builder/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /pc-builder/core/src/main/java/com/scaler/pcbuilder/core/components/GPU.java: -------------------------------------------------------------------------------- 1 | package com.scaler.pcbuilder.core.components; 2 | 3 | public class GPU { 4 | } 5 | -------------------------------------------------------------------------------- /pc-builder/core/src/main/java/com/scaler/pcbuilder/core/components/RAM.java: -------------------------------------------------------------------------------- 1 | package com.scaler.pcbuilder.core.components; 2 | 3 | public class RAM { 4 | } 5 | -------------------------------------------------------------------------------- /springbasics/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scaleracademy/Oct-Nov-Dec-Projects/main/springbasics/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /01-JavaBasics/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scaleracademy/Oct-Nov-Dec-Projects/main/01-JavaBasics/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /pc-builder/core/src/main/java/com/scaler/pcbuilder/core/components/CPU.java: -------------------------------------------------------------------------------- 1 | package com.scaler.pcbuilder.core.components; 2 | 3 | public abstract class CPU { 4 | } 5 | -------------------------------------------------------------------------------- /springbasics-2/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scaleracademy/Oct-Nov-Dec-Projects/main/springbasics-2/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /pc-builder/core/src/main/java/com/scaler/pcbuilder/core/components/Storage.java: -------------------------------------------------------------------------------- 1 | package com.scaler.pcbuilder.core.components; 2 | 3 | public interface Storage { 4 | } 5 | -------------------------------------------------------------------------------- /spring-sockets-1/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scaleracademy/Oct-Nov-Dec-Projects/main/spring-sockets-1/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /springjpa-basics-1/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scaleracademy/Oct-Nov-Dec-Projects/main/springjpa-basics-1/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /01-JavaBasics/.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Datasource local storage ignored files 5 | /dataSources/ 6 | /dataSources.local.xml 7 | -------------------------------------------------------------------------------- /pc-builder/core/src/main/java/com/scaler/pcbuilder/core/connectors/pci/PCISlot.java: -------------------------------------------------------------------------------- 1 | package com.scaler.pcbuilder.core.connectors.pci; 2 | 3 | public interface PCISlot { 4 | } 5 | -------------------------------------------------------------------------------- /pc-builder/core/src/main/java/com/scaler/pcbuilder/core/peripherals/Peripheral.java: -------------------------------------------------------------------------------- 1 | package com.scaler.pcbuilder.core.peripherals; 2 | 3 | public interface Peripheral { 4 | } 5 | -------------------------------------------------------------------------------- /pc-builder/core/src/main/java/com/scaler/pcbuilder/core/connectors/ram/RAMChannels.java: -------------------------------------------------------------------------------- 1 | package com.scaler.pcbuilder.core.connectors.ram; 2 | 3 | public interface RAMChannels { 4 | } 5 | -------------------------------------------------------------------------------- /pc-builder/core/src/main/java/com/scaler/pcbuilder/core/peripherals/Mouse.java: -------------------------------------------------------------------------------- 1 | package com.scaler.pcbuilder.core.peripherals; 2 | 3 | public class Mouse implements Peripheral{ 4 | } 5 | -------------------------------------------------------------------------------- /spring-sockets-1/src/main/resources/static/music/music1.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scaleracademy/Oct-Nov-Dec-Projects/main/spring-sockets-1/src/main/resources/static/music/music1.mp3 -------------------------------------------------------------------------------- /spring-sockets-1/src/main/resources/static/music/music2.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scaleracademy/Oct-Nov-Dec-Projects/main/spring-sockets-1/src/main/resources/static/music/music2.mp3 -------------------------------------------------------------------------------- /spring-sockets-1/src/main/resources/static/music/music3.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scaleracademy/Oct-Nov-Dec-Projects/main/spring-sockets-1/src/main/resources/static/music/music3.mp3 -------------------------------------------------------------------------------- /spring-sockets-1/src/main/resources/static/music/music4.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scaleracademy/Oct-Nov-Dec-Projects/main/spring-sockets-1/src/main/resources/static/music/music4.mp3 -------------------------------------------------------------------------------- /pc-builder/core/src/main/java/com/scaler/pcbuilder/core/peripherals/Display.java: -------------------------------------------------------------------------------- 1 | package com.scaler.pcbuilder.core.peripherals; 2 | 3 | public class Display implements Peripheral { 4 | } 5 | -------------------------------------------------------------------------------- /pc-builder/core/src/main/java/com/scaler/pcbuilder/core/peripherals/Keyboard.java: -------------------------------------------------------------------------------- 1 | package com.scaler.pcbuilder.core.peripherals; 2 | 3 | public class Keyboard implements Peripheral{ 4 | } 5 | -------------------------------------------------------------------------------- /pc-builder/core/src/main/java/com/scaler/pcbuilder/core/peripherals/Printer.java: -------------------------------------------------------------------------------- 1 | package com.scaler.pcbuilder.core.peripherals; 2 | 3 | public class Printer implements Peripheral { 4 | } 5 | -------------------------------------------------------------------------------- /pc-builder/core/src/main/java/com/scaler/pcbuilder/core/peripherals/Speakers.java: -------------------------------------------------------------------------------- 1 | package com.scaler.pcbuilder.core.peripherals; 2 | 3 | public class Speakers implements Peripheral { 4 | } 5 | -------------------------------------------------------------------------------- /pc-builder/core/src/main/java/com/scaler/pcbuilder/core/connectors/storage/StorageConnector.java: -------------------------------------------------------------------------------- 1 | package com.scaler.pcbuilder.core.connectors.storage; 2 | 3 | public interface StorageConnector { 4 | } 5 | -------------------------------------------------------------------------------- /pc-builder/core/src/main/java/com/scaler/pcbuilder/core/vendors/ChipVendor.java: -------------------------------------------------------------------------------- 1 | package com.scaler.pcbuilder.core.vendors; 2 | 3 | public enum ChipVendor { 4 | AMD, 5 | INTEL, 6 | NVIDIA 7 | } 8 | -------------------------------------------------------------------------------- /pc-builder/core/src/main/java/com/scaler/pcbuilder/core/compatibility/FormFactor.java: -------------------------------------------------------------------------------- 1 | package com.scaler.pcbuilder.core.compatibility; 2 | 3 | public interface FormFactor { 4 | FormFactors formFactor(); 5 | } 6 | -------------------------------------------------------------------------------- /01-JavaBasics/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /01-JavaBasics/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /pc-builder/core/src/main/java/com/scaler/pcbuilder/core/vendors/BoardVendor.java: -------------------------------------------------------------------------------- 1 | package com.scaler.pcbuilder.core.vendors; 2 | 3 | public enum BoardVendor { 4 | GENERIC, 5 | GIGABYTE, 6 | MSI, 7 | ASUS 8 | } 9 | -------------------------------------------------------------------------------- /pc-builder/core/src/main/java/com/scaler/pcbuilder/core/components/storage/HDD.java: -------------------------------------------------------------------------------- 1 | package com.scaler.pcbuilder.core.components.storage; 2 | 3 | import com.scaler.pcbuilder.core.components.Storage; 4 | 5 | public class HDD implements Storage { 6 | } 7 | -------------------------------------------------------------------------------- /pc-builder/core/src/main/java/com/scaler/pcbuilder/core/components/storage/SSD.java: -------------------------------------------------------------------------------- 1 | package com.scaler.pcbuilder.core.components.storage; 2 | 3 | import com.scaler.pcbuilder.core.components.Storage; 4 | 5 | public class SSD implements Storage { 6 | } 7 | -------------------------------------------------------------------------------- /pc-builder/core/src/main/java/com/scaler/pcbuilder/core/components/Cooler.java: -------------------------------------------------------------------------------- 1 | package com.scaler.pcbuilder.core.components; 2 | 3 | import com.scaler.pcbuilder.core.compatibility.PowerConsumer; 4 | 5 | public interface Cooler extends PowerConsumer { 6 | } 7 | -------------------------------------------------------------------------------- /pc-builder/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /01-JavaBasics/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /springbasics-2/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /springbasics/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /spring-sockets-1/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /springjpa-basics-1/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /pc-builder/core/src/main/java/com/scaler/pcbuilder/core/compatibility/PowerConsumer.java: -------------------------------------------------------------------------------- 1 | package com.scaler.pcbuilder.core.compatibility; 2 | 3 | public interface PowerConsumer { 4 | /** 5 | * @return power consumed by the entity in Watts 6 | */ 7 | int consumedPower(); 8 | } 9 | -------------------------------------------------------------------------------- /pc-builder/core/src/main/java/com/scaler/pcbuilder/core/compatibility/PowerSupplier.java: -------------------------------------------------------------------------------- 1 | package com.scaler.pcbuilder.core.compatibility; 2 | 3 | public interface PowerSupplier { 4 | /** 5 | * @return Power supplied by this entity in Watts 6 | */ 7 | int suppliedPower(); 8 | } 9 | -------------------------------------------------------------------------------- /springjpa-basics-1/src/main/java/com/example/springjpabasics1/tasks/TasksRepository.java: -------------------------------------------------------------------------------- 1 | package com.example.springjpabasics1.tasks; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | 5 | public interface TasksRepository extends JpaRepository { 6 | } 7 | -------------------------------------------------------------------------------- /01-JavaBasics/.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /pc-builder/core/src/main/java/com/scaler/pcbuilder/core/connectors/cpu/AM4.java: -------------------------------------------------------------------------------- 1 | package com.scaler.pcbuilder.core.connectors.cpu; 2 | 3 | import com.scaler.pcbuilder.core.vendors.ChipVendor; 4 | import com.scaler.pcbuilder.core.vendors.Vendors; 5 | 6 | @Vendors(chip = ChipVendor.AMD) 7 | public class AM4 extends CPUSocket { 8 | } 9 | -------------------------------------------------------------------------------- /springjpa-basics-1/src/main/resources/application.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 4666 3 | spring: 4 | datasource: 5 | driver-class-name: org.h2.Driver 6 | url: jdbc:h2:file:./test.db 7 | # password: dbuserpass 8 | # username: dbuser 9 | # name: dbname 10 | jpa: 11 | show-sql: true 12 | hibernate: 13 | ddl-auto: validate -------------------------------------------------------------------------------- /pc-builder/core/src/main/java/com/scaler/pcbuilder/core/compatibility/FormFactors.java: -------------------------------------------------------------------------------- 1 | package com.scaler.pcbuilder.core.compatibility; 2 | 3 | public enum FormFactors { 4 | miniITX(100), 5 | microATX(200), 6 | ATX(300); 7 | 8 | public int size = 0; 9 | FormFactors(int size) { 10 | this.size = size; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /spring-sockets-1/src/main/java/com/scaler/springsockets1/models/PlayMessage.java: -------------------------------------------------------------------------------- 1 | package com.scaler.springsockets1.models; 2 | 3 | import lombok.Getter; 4 | import lombok.NoArgsConstructor; 5 | import lombok.ToString; 6 | 7 | @NoArgsConstructor 8 | @Getter 9 | @ToString 10 | public class PlayMessage { 11 | private String instrument; 12 | } 13 | -------------------------------------------------------------------------------- /springbasics/src/test/java/com/scaler/springbasics/SpringbasicsApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.scaler.springbasics; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SpringbasicsApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /pc-builder/core/src/main/java/com/scaler/pcbuilder/core/vendors/Vendors.java: -------------------------------------------------------------------------------- 1 | package com.scaler.pcbuilder.core.vendors; 2 | 3 | import java.lang.annotation.*; 4 | 5 | @Target(ElementType.TYPE) 6 | @Retention(RetentionPolicy.RUNTIME) 7 | public @interface Vendors { 8 | 9 | ChipVendor chip(); 10 | BoardVendor board() default BoardVendor.GENERIC; 11 | } 12 | -------------------------------------------------------------------------------- /springbasics-2/src/test/java/com/example/springbasics2/Springbasics2ApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.example.springbasics2; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class Springbasics2ApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /pc-builder/core/src/main/java/com/scaler/pcbuilder/core/components/cooler/CabinetFan.java: -------------------------------------------------------------------------------- 1 | package com.scaler.pcbuilder.core.components.cooler; 2 | 3 | import com.scaler.pcbuilder.core.components.Cooler; 4 | 5 | public class CabinetFan implements Cooler { 6 | @Override 7 | public int consumedPower() { 8 | return 12; // TODO: make configurable 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /spring-sockets-1/src/test/java/com/scaler/springsockets1/SpringSockets1ApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.scaler.springsockets1; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SpringSockets1ApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /pc-builder/core/src/main/java/com/scaler/pcbuilder/core/components/cooler/LiquidAIO.java: -------------------------------------------------------------------------------- 1 | package com.scaler.pcbuilder.core.components.cooler; 2 | 3 | import com.scaler.pcbuilder.core.components.Cooler; 4 | 5 | public class LiquidAIO implements Cooler { 6 | @Override 7 | public int consumedPower() { 8 | return 20; // TODO: make this configurable 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /pc-builder/core/src/main/java/com/scaler/pcbuilder/core/components/cpu/AMDCPU.java: -------------------------------------------------------------------------------- 1 | package com.scaler.pcbuilder.core.components.cpu; 2 | 3 | import com.scaler.pcbuilder.core.components.CPU; 4 | import com.scaler.pcbuilder.core.vendors.ChipVendor; 5 | import com.scaler.pcbuilder.core.vendors.Vendors; 6 | 7 | @Vendors(chip = ChipVendor.AMD) 8 | public class AMDCPU extends CPU { 9 | } 10 | -------------------------------------------------------------------------------- /pc-builder/core/src/main/java/com/scaler/pcbuilder/core/components/cpu/IntelCPU.java: -------------------------------------------------------------------------------- 1 | package com.scaler.pcbuilder.core.components.cpu; 2 | 3 | import com.scaler.pcbuilder.core.components.CPU; 4 | import com.scaler.pcbuilder.core.vendors.ChipVendor; 5 | import com.scaler.pcbuilder.core.vendors.Vendors; 6 | 7 | @Vendors(chip = ChipVendor.INTEL) 8 | public class IntelCPU extends CPU { 9 | } 10 | -------------------------------------------------------------------------------- /springjpa-basics-1/src/test/java/com/example/springjpabasics1/SpringjpaBasics1ApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.example.springjpabasics1; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SpringjpaBasics1ApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /01-JavaBasics/.idea/codeStyles: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | -------------------------------------------------------------------------------- /pc-builder/core/src/main/java/com/scaler/pcbuilder/core/connectors/cpu/LGA1200.java: -------------------------------------------------------------------------------- 1 | package com.scaler.pcbuilder.core.connectors.cpu; 2 | 3 | import com.scaler.pcbuilder.core.components.CPU; 4 | import com.scaler.pcbuilder.core.vendors.ChipVendor; 5 | import com.scaler.pcbuilder.core.vendors.Vendors; 6 | import lombok.Getter; 7 | 8 | @Vendors(chip = ChipVendor.INTEL) 9 | public class LGA1200 extends CPUSocket { 10 | } 11 | -------------------------------------------------------------------------------- /pc-builder/cli/src/main/java/com/scaler/pcbuilder/cli/PcBuilderApplication.java: -------------------------------------------------------------------------------- 1 | package com.scaler.pcbuilder.cli; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication() 7 | public class PcBuilderApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(PcBuilderApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /springbasics-2/src/main/java/com/example/springbasics2/Springbasics2Application.java: -------------------------------------------------------------------------------- 1 | package com.example.springbasics2; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Springbasics2Application { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Springbasics2Application.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /spring-sockets-1/src/main/java/com/scaler/springsockets1/SpringSockets1Application.java: -------------------------------------------------------------------------------- 1 | package com.scaler.springsockets1; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringSockets1Application { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SpringSockets1Application.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /springjpa-basics-1/src/main/java/com/example/springjpabasics1/SpringjpaBasics1Application.java: -------------------------------------------------------------------------------- 1 | package com.example.springjpabasics1; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringjpaBasics1Application { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SpringjpaBasics1Application.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /pc-builder/core/src/main/java/com/scaler/pcbuilder/core/components/PSU.java: -------------------------------------------------------------------------------- 1 | package com.scaler.pcbuilder.core.components; 2 | 3 | import com.scaler.pcbuilder.core.compatibility.PowerSupplier; 4 | 5 | public abstract class PSU implements PowerSupplier { 6 | 7 | public static PSU create(int capacity) { 8 | return new PSU() { 9 | @Override 10 | public int suppliedPower() { 11 | return capacity; 12 | } 13 | }; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /springjpa-basics-1/src/main/java/com/example/springjpabasics1/common/ErrorResponse.java: -------------------------------------------------------------------------------- 1 | package com.example.springjpabasics1.common; 2 | 3 | import lombok.Getter; 4 | import lombok.NoArgsConstructor; 5 | 6 | @Getter 7 | public class ErrorResponse { 8 | String message; 9 | 10 | private ErrorResponse(String message) { 11 | this.message = message; 12 | } 13 | 14 | public static ErrorResponse from(Exception e) { 15 | return new ErrorResponse(e.getMessage()); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /springbasics/src/main/java/com/scaler/springbasics/hello/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.scaler.springbasics.hello; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | import org.springframework.web.bind.annotation.RestController; 6 | 7 | @RestController() 8 | @RequestMapping("/hello") 9 | public class HelloController { 10 | 11 | @GetMapping("/") 12 | String getHello() { 13 | return "Hello World"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /01-JavaBasics/src/main/java/com/scaler/javabasics/Main.java: -------------------------------------------------------------------------------- 1 | package com.scaler.javabasics; 2 | 3 | /** 4 | * Entry point of our project 5 | */ 6 | public class Main { 7 | public static void main(String[] args) { 8 | System.out.println("Hello World!"); 9 | 10 | // var downloader = new ExampleComDownloader(); 11 | // System.out.println( 12 | // downloader.getWebpageSource() 13 | // ); 14 | var mt = new MultiThreading(); 15 | mt.runAllThreads(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /springbasics/src/main/java/com/scaler/springbasics/SpringbasicsApplication.java: -------------------------------------------------------------------------------- 1 | package com.scaler.springbasics; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.context.annotation.ComponentScan; 6 | 7 | @SpringBootApplication(scanBasePackages = {"com.scaler.springbasics"}) 8 | public class SpringbasicsApplication { 9 | 10 | public static void main(String[] args) { 11 | SpringApplication.run(SpringbasicsApplication.class, args); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /pc-builder/cli/src/main/java/com/scaler/pcbuilder/cli/config/SpringShellConfig.java: -------------------------------------------------------------------------------- 1 | package com.scaler.pcbuilder.cli.config; 2 | 3 | import com.scaler.pcbuilder.cli.shell.InputReader; 4 | import org.jline.reader.LineReader; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | import org.springframework.context.annotation.Lazy; 8 | 9 | @Configuration 10 | public class SpringShellConfig { 11 | 12 | @Bean 13 | public InputReader inputReader(@Lazy LineReader lineReader) { 14 | return new InputReader(lineReader); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /springbasics/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'org.springframework.boot' version '2.5.3' 3 | id 'io.spring.dependency-management' version '1.0.11.RELEASE' 4 | id 'java' 5 | } 6 | 7 | group = 'com.scaler' 8 | version = '0.0.1-SNAPSHOT' 9 | sourceCompatibility = '11' 10 | 11 | repositories { 12 | mavenCentral() 13 | } 14 | 15 | dependencies { 16 | implementation 'org.springframework.boot:spring-boot-starter-web' 17 | developmentOnly 'org.springframework.boot:spring-boot-devtools' 18 | testImplementation 'org.springframework.boot:spring-boot-starter-test' 19 | } 20 | 21 | test { 22 | useJUnitPlatform() 23 | } 24 | -------------------------------------------------------------------------------- /pc-builder/core/src/main/java/com/scaler/pcbuilder/core/compatibility/CompositePowerConsumer.java: -------------------------------------------------------------------------------- 1 | package com.scaler.pcbuilder.core.compatibility; 2 | 3 | import java.util.List; 4 | 5 | public interface CompositePowerConsumer extends PowerConsumer { 6 | 7 | List getChildPowerConsumers(); 8 | 9 | int selfConsumedPower(); 10 | 11 | @Override 12 | default int consumedPower() { 13 | int consumedPower = selfConsumedPower(); 14 | consumedPower += getChildPowerConsumers().stream().mapToInt(PowerConsumer::consumedPower).sum(); 15 | return consumedPower; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /springbasics/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | .gradle 3 | build/ 4 | !gradle/wrapper/gradle-wrapper.jar 5 | !**/src/main/**/build/ 6 | !**/src/test/**/build/ 7 | 8 | ### STS ### 9 | .apt_generated 10 | .classpath 11 | .factorypath 12 | .project 13 | .settings 14 | .springBeans 15 | .sts4-cache 16 | bin/ 17 | !**/src/main/**/bin/ 18 | !**/src/test/**/bin/ 19 | 20 | ### IntelliJ IDEA ### 21 | .idea 22 | *.iws 23 | *.iml 24 | *.ipr 25 | out/ 26 | !**/src/main/**/out/ 27 | !**/src/test/**/out/ 28 | 29 | ### NetBeans ### 30 | /nbproject/private/ 31 | /nbbuild/ 32 | /dist/ 33 | /nbdist/ 34 | /.nb-gradle/ 35 | 36 | ### VS Code ### 37 | .vscode/ 38 | -------------------------------------------------------------------------------- /spring-sockets-1/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | .gradle 3 | build/ 4 | !gradle/wrapper/gradle-wrapper.jar 5 | !**/src/main/**/build/ 6 | !**/src/test/**/build/ 7 | 8 | ### STS ### 9 | .apt_generated 10 | .classpath 11 | .factorypath 12 | .project 13 | .settings 14 | .springBeans 15 | .sts4-cache 16 | bin/ 17 | !**/src/main/**/bin/ 18 | !**/src/test/**/bin/ 19 | 20 | ### IntelliJ IDEA ### 21 | .idea 22 | *.iws 23 | *.iml 24 | *.ipr 25 | out/ 26 | !**/src/main/**/out/ 27 | !**/src/test/**/out/ 28 | 29 | ### NetBeans ### 30 | /nbproject/private/ 31 | /nbbuild/ 32 | /dist/ 33 | /nbdist/ 34 | /.nb-gradle/ 35 | 36 | ### VS Code ### 37 | .vscode/ 38 | -------------------------------------------------------------------------------- /springbasics-2/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | .gradle 3 | build/ 4 | !gradle/wrapper/gradle-wrapper.jar 5 | !**/src/main/**/build/ 6 | !**/src/test/**/build/ 7 | 8 | ### STS ### 9 | .apt_generated 10 | .classpath 11 | .factorypath 12 | .project 13 | .settings 14 | .springBeans 15 | .sts4-cache 16 | bin/ 17 | !**/src/main/**/bin/ 18 | !**/src/test/**/bin/ 19 | 20 | ### IntelliJ IDEA ### 21 | .idea 22 | *.iws 23 | *.iml 24 | *.ipr 25 | out/ 26 | !**/src/main/**/out/ 27 | !**/src/test/**/out/ 28 | 29 | ### NetBeans ### 30 | /nbproject/private/ 31 | /nbbuild/ 32 | /dist/ 33 | /nbdist/ 34 | /.nb-gradle/ 35 | 36 | ### VS Code ### 37 | .vscode/ 38 | -------------------------------------------------------------------------------- /springbasics-2/src/main/java/com/example/springbasics2/HelloResponse.java: -------------------------------------------------------------------------------- 1 | package com.example.springbasics2; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | 5 | public class HelloResponse{ 6 | 7 | public HelloResponse(String greeting, String salutation) { 8 | this.greeting = greeting; 9 | this.salutation = salutation; 10 | } 11 | 12 | @JsonProperty("greeting") 13 | private String greeting; 14 | 15 | @JsonProperty("salutation") 16 | private String salutation; 17 | 18 | public String getGreeting(){ 19 | return greeting; 20 | } 21 | 22 | public String getSalutation(){ 23 | return salutation; 24 | } 25 | } -------------------------------------------------------------------------------- /springjpa-basics-1/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | .gradle 3 | build/ 4 | !gradle/wrapper/gradle-wrapper.jar 5 | !**/src/main/**/build/ 6 | !**/src/test/**/build/ 7 | 8 | ### STS ### 9 | .apt_generated 10 | .classpath 11 | .factorypath 12 | .project 13 | .settings 14 | .springBeans 15 | .sts4-cache 16 | bin/ 17 | !**/src/main/**/bin/ 18 | !**/src/test/**/bin/ 19 | 20 | ### IntelliJ IDEA ### 21 | .idea 22 | *.iws 23 | *.iml 24 | *.ipr 25 | out/ 26 | !**/src/main/**/out/ 27 | !**/src/test/**/out/ 28 | 29 | ### NetBeans ### 30 | /nbproject/private/ 31 | /nbbuild/ 32 | /dist/ 33 | /nbdist/ 34 | /.nb-gradle/ 35 | 36 | ### VS Code ### 37 | .vscode/ 38 | -------------------------------------------------------------------------------- /pc-builder/cli/src/main/java/com/scaler/pcbuilder/cli/shell/PCBuilderPromptProvider.java: -------------------------------------------------------------------------------- 1 | package com.scaler.pcbuilder.cli.shell; 2 | 3 | import org.jline.utils.AttributedString; 4 | import org.jline.utils.AttributedStyle; 5 | import org.springframework.shell.jline.PromptProvider; 6 | import org.springframework.stereotype.Component; 7 | 8 | @Component 9 | public class PCBuilderPromptProvider implements PromptProvider { 10 | 11 | @Override 12 | public AttributedString getPrompt() { 13 | return new AttributedString("PC-BUILDER:>", 14 | AttributedStyle.DEFAULT.foreground(AttributedStyle.RED) 15 | ); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /pc-builder/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | .gradle 3 | build/ 4 | !gradle/wrapper/gradle-wrapper.jar 5 | !**/src/main/**/build/ 6 | !**/src/test/**/build/ 7 | 8 | ### STS ### 9 | .apt_generated 10 | .classpath 11 | .factorypath 12 | .project 13 | .settings 14 | .springBeans 15 | .sts4-cache 16 | bin/ 17 | !**/src/main/**/bin/ 18 | !**/src/test/**/bin/ 19 | 20 | ### IntelliJ IDEA ### 21 | .idea 22 | *.iws 23 | *.iml 24 | *.ipr 25 | out/ 26 | !**/src/main/**/out/ 27 | !**/src/test/**/out/ 28 | 29 | ### NetBeans ### 30 | /nbproject/private/ 31 | /nbbuild/ 32 | /dist/ 33 | /nbdist/ 34 | /.nb-gradle/ 35 | 36 | ### VS Code ### 37 | .vscode/ 38 | 39 | ### Spring Shell 40 | spring-shell.log 41 | -------------------------------------------------------------------------------- /pc-builder/cli/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: "org.springframework.boot" 2 | apply plugin: "application" 3 | 4 | mainClassName = "com.scaler.pcbuilder.PcBuilderApplication" 5 | 6 | dependencies { 7 | implementation project(":core") 8 | implementation 'org.springframework.boot:spring-boot-starter' 9 | implementation 'org.springframework.shell:spring-shell-starter:2.0.1.RELEASE' 10 | 11 | developmentOnly 'org.springframework.boot:spring-boot-devtools' 12 | annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor' 13 | testImplementation 'org.springframework.boot:spring-boot-starter-test' 14 | 15 | } 16 | 17 | bootJar { 18 | enabled = true 19 | } -------------------------------------------------------------------------------- /spring-sockets-1/src/main/java/com/scaler/springsockets1/MusicPlayController.java: -------------------------------------------------------------------------------- 1 | package com.scaler.springsockets1; 2 | 3 | import com.scaler.springsockets1.models.PlayMessage; 4 | import org.springframework.messaging.handler.annotation.MessageMapping; 5 | import org.springframework.messaging.handler.annotation.SendTo; 6 | import org.springframework.stereotype.Controller; 7 | 8 | @Controller 9 | public class MusicPlayController { 10 | 11 | @MessageMapping("/play") 12 | @SendTo("/instruments/play") 13 | public PlayMessage playInstrument(PlayMessage playMessage) { 14 | System.out.println("Playing = " + playMessage); 15 | return playMessage; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /springbasics-2/src/main/java/com/example/springbasics2/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.example.springbasics2; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | import org.springframework.web.bind.annotation.RestController; 6 | 7 | @RestController() 8 | @RequestMapping("/hello") 9 | public class HelloController { 10 | 11 | 12 | @GetMapping("/greet") 13 | HelloResponse greet() { 14 | return new HelloResponse("Hello", "Good Morning"); 15 | } 16 | 17 | @GetMapping("/world") 18 | String getHello() { 19 | return "hello world"; 20 | } 21 | 22 | 23 | @GetMapping("") 24 | String getHelloWorld() { 25 | return "hello!"; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /spring-sockets-1/src/main/resources/static/music.js: -------------------------------------------------------------------------------- 1 | ;([1, 2, 3, 4]).forEach(id => { 2 | document.getElementById('btn' + id).onclick = function () { 3 | 4 | client.send( 5 | '/app/play', 6 | {}, 7 | JSON.stringify({instrument: 'aud'+id}) 8 | ) 9 | 10 | } 11 | }) 12 | 13 | let sock; 14 | let client; 15 | 16 | window.onload = function () { 17 | sock = new SockJS('/music-mania') // creates a websocket connection 18 | client = Stomp.over(sock) // wraps socket into Stomp object 19 | 20 | client.connect({}, function () { 21 | client.subscribe('/instruments/play', function (data) { 22 | let body = JSON.parse(data.body) 23 | document.getElementById(body.instrument).play() 24 | }) 25 | }) 26 | } 27 | 28 | -------------------------------------------------------------------------------- /01-JavaBasics/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'java' 3 | } 4 | 5 | group 'com.scaler' 6 | version '1.0-SNAPSHOT' 7 | 8 | repositories { 9 | mavenCentral() 10 | } 11 | 12 | dependencies { 13 | implementation 'com.squareup.retrofit2:retrofit:2.9.0' 14 | 15 | testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0' 16 | testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0' 17 | } 18 | 19 | jar { 20 | manifest { 21 | attributes 'Main-Class': 'com.scaler.javabasics.Main' 22 | } 23 | // to include the sources of the libraries 24 | from sourceSets.main.output 25 | dependsOn configurations.runtimeClasspath 26 | from { 27 | configurations.runtimeClasspath.findAll { it.name.endsWith('jar') } 28 | .collect { zipTree(it) } 29 | } 30 | } 31 | 32 | test { 33 | useJUnitPlatform() 34 | } -------------------------------------------------------------------------------- /pc-builder/core/src/main/java/com/scaler/pcbuilder/core/connectors/cpu/CPUSocket.java: -------------------------------------------------------------------------------- 1 | package com.scaler.pcbuilder.core.connectors.cpu; 2 | 3 | import com.scaler.pcbuilder.core.components.CPU; 4 | import com.scaler.pcbuilder.core.vendors.ChipVendor; 5 | import com.scaler.pcbuilder.core.vendors.Vendors; 6 | import lombok.Getter; 7 | 8 | public abstract class CPUSocket { 9 | @Getter 10 | private CPU cpu; 11 | 12 | void connect(CPU cpu) { 13 | // vendor of CPU 14 | ChipVendor cpuChipVendor = cpu.getClass().getAnnotation(Vendors.class).chip(); 15 | ChipVendor socketChipVendor = this.getClass().getAnnotation(Vendors.class).chip(); 16 | 17 | if (cpuChipVendor != socketChipVendor) { 18 | throw new IllegalArgumentException("Cannot connect " + cpuChipVendor + " CPU to " + socketChipVendor + " socket"); 19 | } 20 | 21 | this.cpu = cpu; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /01-JavaBasics/src/main/java/com/scaler/javabasics/ExampleComDownloader.java: -------------------------------------------------------------------------------- 1 | package com.scaler.javabasics; 2 | 3 | import okhttp3.OkHttpClient; 4 | import okhttp3.Request; 5 | import okhttp3.Response; 6 | 7 | import java.io.IOException; 8 | 9 | public class ExampleComDownloader { 10 | OkHttpClient httpClient; 11 | Request.Builder requestBuilder = new Request.Builder().get().url("http://example.com"); 12 | 13 | public ExampleComDownloader() { 14 | httpClient = new OkHttpClient.Builder().build(); 15 | } 16 | 17 | String getWebpageSource() { 18 | Request webPageRequest = requestBuilder.build(); 19 | try { 20 | Response response = httpClient.newCall(webPageRequest).execute(); 21 | return response.body().string(); 22 | } catch (IOException e) { 23 | e.printStackTrace(); 24 | return ""; 25 | } 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /springbasics-2/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'org.springframework.boot' version '2.5.3' 3 | id 'io.spring.dependency-management' version '1.0.11.RELEASE' 4 | id 'java' 5 | } 6 | 7 | group = 'com.example' 8 | version = '0.0.1-SNAPSHOT' 9 | sourceCompatibility = '11' 10 | 11 | configurations { 12 | compileOnly { 13 | extendsFrom annotationProcessor 14 | } 15 | } 16 | 17 | repositories { 18 | mavenCentral() 19 | } 20 | 21 | dependencies { 22 | implementation 'org.springframework.boot:spring-boot-starter-data-rest' 23 | implementation 'org.springframework.boot:spring-boot-starter-web' 24 | developmentOnly 'org.springframework.boot:spring-boot-devtools' 25 | annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor' 26 | testImplementation 'org.springframework.boot:spring-boot-starter-test' 27 | } 28 | 29 | test { 30 | useJUnitPlatform() 31 | } 32 | -------------------------------------------------------------------------------- /spring-sockets-1/src/main/resources/static/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Music Mania 6 | 7 | 8 | 9 | 10 | 11 | 12 |

Music Mania

13 |

Press any music instrument button

14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /01-JavaBasics/.idea/jarRepositories.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 14 | 15 | 19 | 20 | -------------------------------------------------------------------------------- /springjpa-basics-1/src/main/java/com/example/springjpabasics1/tasks/TaskEntity.java: -------------------------------------------------------------------------------- 1 | package com.example.springjpabasics1.tasks; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnore; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Getter; 7 | import lombok.NoArgsConstructor; 8 | import lombok.Setter; 9 | 10 | import javax.persistence.*; 11 | 12 | @Entity 13 | @NoArgsConstructor 14 | @Getter 15 | @Setter 16 | public class TaskEntity { 17 | 18 | public TaskEntity(String name, Boolean done) { 19 | this.name = name; 20 | this.done = done; 21 | } 22 | 23 | @Id 24 | @GeneratedValue(strategy = GenerationType.SEQUENCE) 25 | @Column() 26 | private Integer id; 27 | 28 | @JsonProperty("name") 29 | @Column(nullable = false) 30 | String name; 31 | 32 | @JsonProperty("done") 33 | @Column() 34 | Boolean done = false; 35 | } 36 | -------------------------------------------------------------------------------- /spring-sockets-1/src/main/java/com/scaler/springsockets1/WebSocketConfig.java: -------------------------------------------------------------------------------- 1 | package com.scaler.springsockets1; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.messaging.simp.config.MessageBrokerRegistry; 5 | import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker; 6 | import org.springframework.web.socket.config.annotation.StompEndpointRegistry; 7 | import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer; 8 | 9 | @Configuration 10 | @EnableWebSocketMessageBroker 11 | public class WebSocketConfig implements WebSocketMessageBrokerConfigurer { 12 | 13 | @Override 14 | public void configureMessageBroker(MessageBrokerRegistry config) { 15 | config.enableSimpleBroker("/instruments"); 16 | config.setApplicationDestinationPrefixes("/app"); 17 | } 18 | 19 | @Override 20 | public void registerStompEndpoints(StompEndpointRegistry registry) { 21 | registry.addEndpoint("/music-mania").withSockJS(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /springjpa-basics-1/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'org.springframework.boot' version '2.5.3' 3 | id 'io.spring.dependency-management' version '1.0.11.RELEASE' 4 | id 'java' 5 | } 6 | 7 | group = 'com.example' 8 | version = '0.0.1-SNAPSHOT' 9 | sourceCompatibility = '11' 10 | 11 | configurations { 12 | compileOnly { 13 | extendsFrom annotationProcessor 14 | } 15 | } 16 | 17 | repositories { 18 | mavenCentral() 19 | } 20 | 21 | dependencies { 22 | implementation 'org.springframework.boot:spring-boot-starter-data-jpa' 23 | implementation 'org.springframework.boot:spring-boot-starter-web' 24 | compileOnly 'org.projectlombok:lombok' 25 | developmentOnly 'org.springframework.boot:spring-boot-devtools' 26 | runtimeOnly 'com.h2database:h2' 27 | runtimeOnly 'mysql:mysql-connector-java' 28 | runtimeOnly 'org.postgresql:postgresql' 29 | annotationProcessor 'org.projectlombok:lombok' 30 | testImplementation 'org.springframework.boot:spring-boot-starter-test' 31 | } 32 | 33 | test { 34 | useJUnitPlatform() 35 | } 36 | -------------------------------------------------------------------------------- /spring-sockets-1/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'org.springframework.boot' version '2.5.3' 3 | id 'io.spring.dependency-management' version '1.0.11.RELEASE' 4 | id 'java' 5 | id "io.freefair.lombok" version "6.0.0-m2" 6 | } 7 | 8 | group = 'com.scaler' 9 | version = '0.0.1-SNAPSHOT' 10 | sourceCompatibility = '11' 11 | 12 | configurations { 13 | compileOnly { 14 | extendsFrom annotationProcessor 15 | } 16 | } 17 | 18 | repositories { 19 | mavenCentral() 20 | } 21 | 22 | dependencies { 23 | implementation 'org.springframework.boot:spring-boot-starter-web' 24 | implementation 'org.springframework.boot:spring-boot-starter-websocket' 25 | developmentOnly 'org.springframework.boot:spring-boot-devtools' 26 | annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor' 27 | testImplementation 'org.springframework.boot:spring-boot-starter-test' 28 | } 29 | 30 | jar { 31 | manifest { 32 | attributes "Main-Class": "com.scaler.springsockets1.SpringSockets1Application" 33 | } 34 | } 35 | 36 | test { 37 | useJUnitPlatform() 38 | } 39 | -------------------------------------------------------------------------------- /pc-builder/core/src/test/java/com/scaler/pcbuilder/core/connectors/cpu/CPUSocketTests.java: -------------------------------------------------------------------------------- 1 | package com.scaler.pcbuilder.core.connectors.cpu; 2 | 3 | import com.scaler.pcbuilder.core.components.cpu.AMDCPU; 4 | import com.scaler.pcbuilder.core.components.cpu.IntelCPU; 5 | import org.junit.jupiter.api.Test; 6 | 7 | import static org.junit.jupiter.api.Assertions.assertEquals; 8 | 9 | public class CPUSocketTests { 10 | 11 | @Test 12 | void canConnectIntelCPUtoIntelSocket() { 13 | var socket = new LGA1200(); 14 | var cpu = new IntelCPU(); 15 | 16 | socket.connect(cpu); 17 | 18 | } 19 | 20 | @Test 21 | void cannotConnectIntelCPUtoAMDSocket() { 22 | try { 23 | var socket = new LGA1200(); 24 | var cpu = new AMDCPU(); 25 | 26 | socket.connect(cpu); 27 | // assertNull(socket.getCpu()); 28 | throw new IllegalStateException("Mismatched chip vendors should have not worked"); 29 | } catch (IllegalArgumentException iae) { 30 | assertEquals("Cannot connect AMD CPU to INTEL socket", iae.getMessage()); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /pc-builder/core/src/main/java/com/scaler/pcbuilder/core/components/Cabinet.java: -------------------------------------------------------------------------------- 1 | package com.scaler.pcbuilder.core.components; 2 | 3 | import com.scaler.pcbuilder.core.compatibility.CompositePowerConsumer; 4 | import com.scaler.pcbuilder.core.compatibility.FormFactor; 5 | import com.scaler.pcbuilder.core.compatibility.FormFactors; 6 | import com.scaler.pcbuilder.core.compatibility.PowerConsumer; 7 | 8 | import java.util.Arrays; 9 | import java.util.List; 10 | 11 | public abstract class Cabinet implements FormFactor, CompositePowerConsumer { 12 | 13 | @Override 14 | public abstract FormFactors formFactor(); 15 | 16 | public static Cabinet create (FormFactors formFactor) { 17 | return new Cabinet() { 18 | @Override 19 | public List getChildPowerConsumers() { 20 | return Arrays.asList(); 21 | } 22 | 23 | @Override 24 | public int selfConsumedPower() { 25 | return 0; 26 | } 27 | 28 | @Override 29 | public FormFactors formFactor() { 30 | return formFactor; 31 | } 32 | }; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /pc-builder/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext { 3 | springVersion = "2.5.3" 4 | springDepsVersion = "1.0.11.RELEASE" 5 | junitVersion = "5.7.2" 6 | lombokVersion= "6.1.0" 7 | } 8 | 9 | repositories { 10 | google() 11 | mavenCentral() 12 | } 13 | } 14 | 15 | plugins { 16 | id 'org.springframework.boot' version "$springVersion" 17 | id 'io.spring.dependency-management' version "$springDepsVersion" 18 | id "io.freefair.lombok" version "$lombokVersion" 19 | id 'java' 20 | } 21 | 22 | 23 | allprojects { 24 | apply plugin: "java" 25 | apply plugin: "io.spring.dependency-management" 26 | apply plugin: "io.freefair.lombok" 27 | 28 | group = 'com.scaler' 29 | version = '0.0.1-SNAPSHOT' 30 | sourceCompatibility = '11' 31 | 32 | repositories { 33 | google() 34 | mavenCentral() 35 | } 36 | 37 | dependencies { 38 | testImplementation "org.junit.jupiter:junit-jupiter-api:$junitVersion" 39 | testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion" 40 | } 41 | 42 | configurations { 43 | compileOnly { 44 | extendsFrom annotationProcessor 45 | } 46 | } 47 | 48 | bootJar { 49 | enabled = false 50 | } 51 | 52 | 53 | test { 54 | useJUnitPlatform() 55 | } 56 | 57 | 58 | } 59 | 60 | 61 | -------------------------------------------------------------------------------- /pc-builder/core/src/test/java/com/scaler/pcbuilder/core/PCBuilderTests.java: -------------------------------------------------------------------------------- 1 | package com.scaler.pcbuilder.core; 2 | 3 | 4 | import com.scaler.pcbuilder.core.compatibility.FormFactors; 5 | import com.scaler.pcbuilder.core.components.Cabinet; 6 | import com.scaler.pcbuilder.core.components.MotherBoard; 7 | import com.scaler.pcbuilder.core.components.PSU; 8 | import com.scaler.pcbuilder.core.peripherals.Display; 9 | import com.scaler.pcbuilder.core.peripherals.Keyboard; 10 | import com.scaler.pcbuilder.core.systems.KVM; 11 | import com.scaler.pcbuilder.core.systems.Tower; 12 | import org.junit.jupiter.api.Test; 13 | 14 | public class PCBuilderTests { 15 | 16 | @Test 17 | void canCreateBasicPCWithBuilder() { 18 | var pcBuilder = new PC.Builder() 19 | .withKVM(new KVM.Builder().withKeyboard(new Keyboard()).withDisplay(new Display()).build()) 20 | .withTower(new Tower.Builder() 21 | .withCabinet(Cabinet.create(FormFactors.ATX)) 22 | .withMotherBoard(MotherBoard.create(FormFactors.ATX)) 23 | .withPsu(PSU.create(500)) 24 | .build() 25 | ); 26 | var pc = pcBuilder.build(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /01-JavaBasics/src/main/java/com/scaler/javabasics/MultiThreading.java: -------------------------------------------------------------------------------- 1 | package com.scaler.javabasics; 2 | 3 | import java.util.concurrent.Executor; 4 | import java.util.concurrent.LinkedBlockingQueue; 5 | import java.util.concurrent.ThreadPoolExecutor; 6 | import java.util.concurrent.TimeUnit; 7 | 8 | public class MultiThreading { 9 | Runnable r = new Runnable() { 10 | @Override 11 | public void run() { 12 | for (int i = 0; i < 1000; i++) { 13 | System.out.println("iteration " + i + " running on " + Thread.currentThread().getName()); 14 | } 15 | System.out.println("======================= END ================== " + Thread.currentThread().getName()); 16 | executor.shutdown(); 17 | } 18 | }; 19 | 20 | ThreadPoolExecutor executor = new ThreadPoolExecutor(2, 3, 21 | 0L, TimeUnit.MILLISECONDS, 22 | new LinkedBlockingQueue()); 23 | 24 | void runAllThreads() { 25 | // Q: make three runs of r parallelly on the executor 26 | executor.execute(r); 27 | executor.execute(r); 28 | executor.execute(r); 29 | 30 | // Q2: Print odd nos on thread-1 and even on thread-2 but sequentially 31 | } 32 | 33 | 34 | } 35 | -------------------------------------------------------------------------------- /pc-builder/core/src/main/java/com/scaler/pcbuilder/core/components/MotherBoard.java: -------------------------------------------------------------------------------- 1 | package com.scaler.pcbuilder.core.components; 2 | 3 | import com.scaler.pcbuilder.core.compatibility.CompositePowerConsumer; 4 | import com.scaler.pcbuilder.core.compatibility.FormFactor; 5 | import com.scaler.pcbuilder.core.compatibility.FormFactors; 6 | import com.scaler.pcbuilder.core.compatibility.PowerConsumer; 7 | 8 | import java.util.Arrays; 9 | import java.util.List; 10 | 11 | public abstract class MotherBoard implements FormFactor, CompositePowerConsumer { 12 | @Override 13 | public abstract FormFactors formFactor(); 14 | 15 | // TODO: whenever CPU, GPU, PCI cards are connected, add them to child power consumers 16 | 17 | 18 | public static MotherBoard create(FormFactors formFactor) { 19 | 20 | return new MotherBoard() { 21 | @Override 22 | public List getChildPowerConsumers() { 23 | return Arrays.asList(); 24 | } 25 | 26 | @Override 27 | public int selfConsumedPower() { 28 | return 0; 29 | } 30 | 31 | @Override 32 | public FormFactors formFactor() { 33 | return formFactor; 34 | } 35 | }; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /pc-builder/cli/src/main/java/com/scaler/pcbuilder/cli/shell/InputReader.java: -------------------------------------------------------------------------------- 1 | package com.scaler.pcbuilder.cli.shell; 2 | 3 | import org.jline.reader.LineReader; 4 | import org.springframework.util.StringUtils; 5 | 6 | public class InputReader { 7 | public static final Character DEFAULT_MASK = '*'; 8 | 9 | private Character mask; 10 | private LineReader lineReader; 11 | 12 | public InputReader(LineReader lineReader) { 13 | this(lineReader, null); 14 | } 15 | 16 | public InputReader(LineReader lineReader, Character mask) { 17 | this.lineReader = lineReader; 18 | this.mask = mask != null ? mask : DEFAULT_MASK; 19 | } 20 | 21 | public String prompt(String prompt) { 22 | return prompt(prompt, null, true); 23 | } 24 | 25 | public String prompt(String prompt, String defaultValue) { 26 | return prompt(prompt, defaultValue, true); 27 | } 28 | 29 | public String prompt(String prompt, String defaultValue, boolean echo) { 30 | String answer = ""; 31 | if (echo) { 32 | answer = lineReader.readLine(prompt + ": "); 33 | } else { 34 | answer = lineReader.readLine(prompt + ": ", mask); 35 | } 36 | if (StringUtils.isEmpty(answer)) { 37 | return defaultValue; 38 | } 39 | return answer; 40 | } 41 | } -------------------------------------------------------------------------------- /pc-builder/core/src/main/java/com/scaler/pcbuilder/core/systems/KVM.java: -------------------------------------------------------------------------------- 1 | package com.scaler.pcbuilder.core.systems; 2 | 3 | import com.scaler.pcbuilder.core.peripherals.Display; 4 | import com.scaler.pcbuilder.core.peripherals.Keyboard; 5 | import com.scaler.pcbuilder.core.peripherals.Mouse; 6 | import lombok.AccessLevel; 7 | import lombok.AllArgsConstructor; 8 | import lombok.Getter; 9 | 10 | @AllArgsConstructor(access = AccessLevel.PRIVATE) 11 | @Getter 12 | public class KVM { 13 | private Keyboard keyboard; 14 | private Display display; 15 | private Mouse mouse; 16 | 17 | 18 | public static class Builder { 19 | private Keyboard keyboard; 20 | private Display display; 21 | private Mouse mouse; 22 | 23 | public Builder withKeyboard(Keyboard keyboard) { 24 | this.keyboard = keyboard; 25 | return this; 26 | } 27 | 28 | public Builder withDisplay(Display display) { 29 | this.display = display; 30 | return this; 31 | } 32 | 33 | public Builder withMouse(Mouse mouse) { 34 | this.mouse = mouse; 35 | return this; 36 | } 37 | 38 | public KVM build() { 39 | if (display == null) throw new IllegalStateException("KVM with no display being built"); 40 | if (keyboard == null) throw new IllegalStateException("KVM with no keyboard being built"); 41 | return new KVM(keyboard, display, mouse); 42 | } 43 | } 44 | 45 | 46 | } 47 | -------------------------------------------------------------------------------- /springjpa-basics-1/src/main/java/com/example/springjpabasics1/tasks/TasksService.java: -------------------------------------------------------------------------------- 1 | package com.example.springjpabasics1.tasks; 2 | 3 | import org.springframework.stereotype.Service; 4 | 5 | import javax.persistence.EntityNotFoundException; 6 | import java.util.List; 7 | import java.util.NoSuchElementException; 8 | 9 | @Service 10 | public class TasksService { 11 | 12 | private TasksRepository tasksRepository; 13 | 14 | public TasksService(TasksRepository tasksRepository) { 15 | this.tasksRepository = tasksRepository; 16 | } 17 | 18 | TaskEntity addNewTask(String taskName) { 19 | var task = new TaskEntity(taskName, false); 20 | tasksRepository.save(task); 21 | return task; 22 | } 23 | 24 | List getAllTasks() { 25 | return tasksRepository.findAll(); 26 | } 27 | 28 | TaskEntity getTaskById(int index) { 29 | try { 30 | return tasksRepository.findById(index).get(); 31 | } catch (EntityNotFoundException | NoSuchElementException e) { 32 | throw new NoSuchTaskException(); 33 | } 34 | } 35 | 36 | TaskEntity setTaskDone(int index, Boolean done) { 37 | var task = getTaskById(index); 38 | task.setDone(done); 39 | return tasksRepository.save(task); 40 | } 41 | 42 | boolean deleteTask(int index) { 43 | tasksRepository.delete( 44 | getTaskById(index) 45 | ); 46 | return true; 47 | } 48 | 49 | static class NoSuchTaskException extends RuntimeException { 50 | public NoSuchTaskException() { 51 | super("No such task exists"); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /pc-builder/cli/src/main/java/com/scaler/pcbuilder/cli/PCBuilderCLI.java: -------------------------------------------------------------------------------- 1 | package com.scaler.pcbuilder.cli; 2 | 3 | import com.scaler.pcbuilder.cli.shell.InputReader; 4 | import com.scaler.pcbuilder.core.PC; 5 | import com.scaler.pcbuilder.core.compatibility.FormFactors; 6 | import com.scaler.pcbuilder.core.components.Cabinet; 7 | import com.scaler.pcbuilder.core.components.MotherBoard; 8 | import com.scaler.pcbuilder.core.components.PSU; 9 | import com.scaler.pcbuilder.core.peripherals.Display; 10 | import com.scaler.pcbuilder.core.peripherals.Keyboard; 11 | import com.scaler.pcbuilder.core.systems.KVM; 12 | import com.scaler.pcbuilder.core.systems.Tower; 13 | import org.springframework.beans.factory.annotation.Autowired; 14 | import org.springframework.shell.standard.ShellComponent; 15 | import org.springframework.shell.standard.ShellMethod; 16 | 17 | @ShellComponent 18 | public class PCBuilderCLI { 19 | @Autowired InputReader inputReader; 20 | 21 | @ShellMethod("Provide help about this project") 22 | public String build() { 23 | 24 | var pcBuilder = new PC.Builder() 25 | .withKVM(new KVM.Builder() 26 | .withDisplay(new Display()) 27 | .withKeyboard(new Keyboard()) 28 | .build() 29 | ) 30 | .withTower(new Tower.Builder() 31 | .withCabinet(Cabinet.create(FormFactors.ATX)) 32 | .withMotherBoard(MotherBoard.create(FormFactors.ATX)) 33 | .withPsu(PSU.create(500)) 34 | .build() 35 | ); 36 | 37 | var pc1 = pcBuilder.build(); 38 | var pc2 = pcBuilder.build(); 39 | 40 | System.out.println(pc1 == pc2); 41 | 42 | return "Congrats PC is build"; 43 | 44 | 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /pc-builder/core/src/main/java/com/scaler/pcbuilder/core/PC.java: -------------------------------------------------------------------------------- 1 | package com.scaler.pcbuilder.core; 2 | 3 | import com.scaler.pcbuilder.core.systems.Tower; 4 | import com.scaler.pcbuilder.core.systems.KVM; 5 | import com.scaler.pcbuilder.core.peripherals.Peripheral; 6 | import lombok.AllArgsConstructor; 7 | import lombok.Builder; 8 | 9 | import java.util.ArrayList; 10 | import java.util.Arrays; 11 | import java.util.List; 12 | 13 | @AllArgsConstructor 14 | public class PC { 15 | 16 | private PC() { 17 | } 18 | 19 | Tower tower; 20 | KVM kvm; 21 | List peripherals; 22 | 23 | public static class Builder { 24 | Tower tower; 25 | KVM kvm; 26 | List peripherals; 27 | 28 | public Builder withTower(Tower tower) { 29 | this.tower = tower; 30 | return this; 31 | } 32 | 33 | public Builder withKVM(KVM kvm) { 34 | this.kvm = kvm; 35 | return this; 36 | } 37 | 38 | public Builder addPeripherals(Peripheral... peripherals) { 39 | 40 | if (this.peripherals == null) { 41 | this.peripherals = new ArrayList<>(); 42 | } 43 | this.peripherals.addAll(Arrays.asList(peripherals)); 44 | return this; 45 | } 46 | 47 | public Builder clearPeripherals() { 48 | if (this.peripherals != null) { 49 | this.peripherals.clear(); 50 | } 51 | return this; 52 | } 53 | 54 | public PC build() { 55 | var pc = new PC(tower, kvm, peripherals); 56 | // TODO: check tower exists 57 | // TODO: check kvm exists 58 | // TODO: tower has all ports that KVM needs 59 | // TODO: tower has ports required for the peripherals 60 | 61 | return pc; 62 | } 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /pc-builder/core/src/main/java/com/scaler/pcbuilder/core/systems/Tower.java: -------------------------------------------------------------------------------- 1 | package com.scaler.pcbuilder.core.systems; 2 | 3 | import com.scaler.pcbuilder.core.components.Cabinet; 4 | import com.scaler.pcbuilder.core.components.MotherBoard; 5 | import com.scaler.pcbuilder.core.components.PSU; 6 | import lombok.AccessLevel; 7 | import lombok.AllArgsConstructor; 8 | import lombok.Getter; 9 | 10 | @AllArgsConstructor(access = AccessLevel.PRIVATE) 11 | @Getter 12 | public class Tower { 13 | 14 | private MotherBoard motherBoard; 15 | private Cabinet cabinet; 16 | private PSU psu; 17 | 18 | 19 | public static final class Builder { 20 | private MotherBoard motherBoard; 21 | private Cabinet cabinet; 22 | private PSU psu; 23 | 24 | public Builder() { 25 | } 26 | 27 | 28 | public Builder withMotherBoard(MotherBoard motherBoard) { 29 | this.motherBoard = motherBoard; 30 | return this; 31 | } 32 | 33 | public Builder withCabinet(Cabinet cabinet) { 34 | this.cabinet = cabinet; 35 | return this; 36 | } 37 | 38 | public Builder withPsu(PSU psu) { 39 | this.psu = psu; 40 | return this; 41 | } 42 | 43 | public Tower build() { 44 | 45 | if (cabinet == null) throw new IllegalStateException("Cannot build tower without a cabinet"); 46 | if (motherBoard == null) throw new IllegalStateException("Cannot build tower without a motherboard"); 47 | if (psu == null) throw new IllegalStateException("Cannot build tower without a PSU"); 48 | 49 | 50 | if (cabinet.formFactor().size < motherBoard.formFactor().size) { 51 | throw new IllegalStateException("Cannot fit bigger motherboard in smaller cabinet"); 52 | } 53 | 54 | if (psu.suppliedPower() < (motherBoard.consumedPower() + cabinet.consumedPower())) { 55 | throw new IllegalStateException("PSU not sufficient for power needs"); 56 | } 57 | 58 | Tower tower = new Tower(motherBoard, cabinet, psu); 59 | return tower; 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /springjpa-basics-1/src/main/java/com/example/springjpabasics1/tasks/TasksController.java: -------------------------------------------------------------------------------- 1 | package com.example.springjpabasics1.tasks; 2 | 3 | import com.example.springjpabasics1.common.ErrorResponse; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import org.springframework.http.HttpStatus; 6 | import org.springframework.http.ResponseEntity; 7 | import org.springframework.web.bind.annotation.*; 8 | 9 | import java.util.List; 10 | 11 | @RequestMapping("/tasks") 12 | @RestController() 13 | public class TasksController { 14 | 15 | static class CreateTaskDto { 16 | @JsonProperty("name") 17 | String name; 18 | } 19 | 20 | private TasksService taskService; 21 | 22 | public TasksController(TasksService taskService) { 23 | this.taskService = taskService; 24 | } 25 | 26 | @GetMapping("/") 27 | ResponseEntity> getAllTodos() { 28 | return ResponseEntity.ok(taskService.getAllTasks()); 29 | } 30 | 31 | @PostMapping("/") 32 | ResponseEntity addNewTodo(@RequestBody CreateTaskDto body) { 33 | return new ResponseEntity(taskService.addNewTask(body.name), HttpStatus.CREATED); 34 | } 35 | 36 | // 200 37 | @GetMapping("/{id}") 38 | TaskEntity getTodoById(@PathVariable Integer id) { 39 | var task = taskService.getTaskById(id); 40 | return taskService.getTaskById(id); 41 | } 42 | 43 | // 202 44 | @DeleteMapping("/{id}") 45 | void deleteTodoById(@PathVariable Integer id) { 46 | taskService.deleteTask(id); 47 | } 48 | 49 | @PutMapping("/{id}/done") 50 | String setTodoDone(@PathVariable Integer id) { 51 | return "Set todo " + id + " to done"; // TODO 52 | } 53 | 54 | @DeleteMapping("/{id}/done") 55 | String setTodoNotDone(@PathVariable Integer id) { 56 | return "Set todo " + id + " to not done"; // TODO 57 | } 58 | 59 | @ExceptionHandler({TasksService.NoSuchTaskException.class}) 60 | ResponseEntity handleErrors(Exception e) { 61 | if (e instanceof TasksService.NoSuchTaskException) { 62 | return new ResponseEntity<>(ErrorResponse.from(e), HttpStatus.NOT_FOUND); 63 | } 64 | 65 | return ResponseEntity.internalServerError().build(); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /pc-builder/core/src/test/java/com/scaler/pcbuilder/core/systems/TowerBuilderTests.java: -------------------------------------------------------------------------------- 1 | package com.scaler.pcbuilder.core.systems; 2 | 3 | import com.scaler.pcbuilder.core.compatibility.FormFactors; 4 | import com.scaler.pcbuilder.core.components.Cabinet; 5 | import com.scaler.pcbuilder.core.components.MotherBoard; 6 | import com.scaler.pcbuilder.core.components.PSU; 7 | import org.junit.jupiter.api.Test; 8 | 9 | import static org.junit.jupiter.api.Assertions.assertEquals; 10 | 11 | public class TowerBuilderTests { 12 | 13 | @Test 14 | void canCreatePCTower() { 15 | var tower = new Tower.Builder() 16 | .withCabinet(Cabinet.create(FormFactors.ATX)) 17 | .withMotherBoard(MotherBoard.create(FormFactors.ATX)) 18 | .withPsu(PSU.create(500)) 19 | .build(); 20 | 21 | } 22 | 23 | @Test 24 | void failToCreateTowerWithoutPSU() { 25 | try { 26 | var tower = new Tower.Builder() 27 | .withCabinet(Cabinet.create(FormFactors.ATX)) 28 | .withMotherBoard(MotherBoard.create(FormFactors.ATX)) 29 | .build(); 30 | } catch (IllegalStateException ise) { 31 | assertEquals("Cannot build tower without a PSU", ise.getMessage()); 32 | } 33 | 34 | } 35 | @Test 36 | void failToCreateTowerWithoutCabinet() { 37 | try { 38 | var tower = new Tower.Builder() 39 | .withMotherBoard(MotherBoard.create(FormFactors.ATX)) 40 | .withPsu(PSU.create(500)) 41 | .build(); 42 | } catch (IllegalStateException ise) { 43 | assertEquals("Cannot build tower without a cabinet", ise.getMessage()); 44 | } 45 | 46 | } 47 | 48 | @Test 49 | void failToCreateTowerIfCabinetBoardSizeMismatch() { 50 | try { 51 | var tower = new Tower.Builder() 52 | .withCabinet(Cabinet.create(FormFactors.microATX)) 53 | .withMotherBoard(MotherBoard.create(FormFactors.ATX)) 54 | .withPsu(PSU.create(500)) 55 | .build(); 56 | } catch (IllegalStateException ise) { 57 | assertEquals("Cannot fit bigger motherboard in smaller cabinet", ise.getMessage()); 58 | } 59 | 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /01-JavaBasics/.gitignore: -------------------------------------------------------------------------------- 1 | ### Java template 2 | # Compiled class file 3 | *.class 4 | 5 | # Log file 6 | *.log 7 | 8 | # BlueJ files 9 | *.ctxt 10 | 11 | # Mobile Tools for Java (J2ME) 12 | .mtj.tmp/ 13 | 14 | # Package Files # 15 | *.jar 16 | *.war 17 | *.nar 18 | *.ear 19 | *.zip 20 | *.tar.gz 21 | *.rar 22 | 23 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 24 | hs_err_pid* 25 | 26 | ### Gradle template 27 | .gradle 28 | **/build/ 29 | !src/**/build/ 30 | 31 | # Ignore Gradle GUI config 32 | gradle-app.setting 33 | 34 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) 35 | !gradle-wrapper.jar 36 | 37 | # Cache of project 38 | .gradletasknamecache 39 | 40 | # # Work around https://youtrack.jetbrains.com/issue/IDEA-116898 41 | # gradle/wrapper/gradle-wrapper.properties 42 | 43 | ### JetBrains template 44 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider 45 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 46 | 47 | # User-specific stuff 48 | .idea/**/workspace.xml 49 | .idea/**/tasks.xml 50 | .idea/**/usage.statistics.xml 51 | .idea/**/dictionaries 52 | .idea/**/shelf 53 | 54 | # Generated files 55 | .idea/**/contentModel.xml 56 | 57 | # Sensitive or high-churn files 58 | .idea/**/dataSources/ 59 | .idea/**/dataSources.ids 60 | .idea/**/dataSources.local.xml 61 | .idea/**/sqlDataSources.xml 62 | .idea/**/dynamic.xml 63 | .idea/**/uiDesigner.xml 64 | .idea/**/dbnavigator.xml 65 | 66 | # Gradle 67 | .idea/**/gradle.xml 68 | .idea/**/libraries 69 | 70 | # Gradle and Maven with auto-import 71 | # When using Gradle or Maven with auto-import, you should exclude module files, 72 | # since they will be recreated, and may cause churn. Uncomment if using 73 | # auto-import. 74 | # .idea/artifacts 75 | # .idea/compiler.xml 76 | # .idea/jarRepositories.xml 77 | # .idea/modules.xml 78 | # .idea/*.iml 79 | # .idea/modules 80 | # *.iml 81 | # *.ipr 82 | 83 | # CMake 84 | cmake-build-*/ 85 | 86 | # Mongo Explorer plugin 87 | .idea/**/mongoSettings.xml 88 | 89 | # File-based project format 90 | *.iws 91 | 92 | # IntelliJ 93 | out/ 94 | 95 | # mpeltonen/sbt-idea plugin 96 | .idea_modules/ 97 | 98 | # JIRA plugin 99 | atlassian-ide-plugin.xml 100 | 101 | # Cursive Clojure plugin 102 | .idea/replstate.xml 103 | 104 | # Crashlytics plugin (for Android Studio and IntelliJ) 105 | com_crashlytics_export_strings.xml 106 | crashlytics.properties 107 | crashlytics-build.properties 108 | fabric.properties 109 | 110 | # Editor-based Rest Client 111 | .idea/httpRequests 112 | 113 | # Android studio 3.1+ serialized cache file 114 | .idea/caches/build_file_checksums.ser 115 | 116 | -------------------------------------------------------------------------------- /pc-builder/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /01-JavaBasics/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /spring-sockets-1/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /springbasics-2/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /springbasics/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /springjpa-basics-1/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /01-JavaBasics/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 24 | 25 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /springbasics-2/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ]; do 30 | ls=$(ls -ld "$PRG") 31 | link=$(expr "$ls" : '.*-> \(.*\)$') 32 | if expr "$link" : '/.*' >/dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=$(dirname "$PRG")"/$link" 36 | fi 37 | done 38 | SAVED="$(pwd)" 39 | cd "$(dirname \"$PRG\")/" >/dev/null 40 | APP_HOME="$(pwd -P)" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=$(basename "$0") 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn() { 53 | echo "$*" 54 | } 55 | 56 | die() { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "$(uname)" in 69 | CYGWIN*) 70 | cygwin=true 71 | ;; 72 | Darwin*) 73 | darwin=true 74 | ;; 75 | MSYS* | MINGW*) 76 | msys=true 77 | ;; 78 | NONSTOP*) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | # Determine the Java command to use to start the JVM. 86 | if [ -n "$JAVA_HOME" ]; then 87 | if [ -x "$JAVA_HOME/jre/sh/java" ]; then 88 | # IBM's JDK on AIX uses strange locations for the executables 89 | JAVACMD="$JAVA_HOME/jre/sh/java" 90 | else 91 | JAVACMD="$JAVA_HOME/bin/java" 92 | fi 93 | if [ ! -x "$JAVACMD" ]; then 94 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 95 | 96 | Please set the JAVA_HOME variable in your environment to match the 97 | location of your Java installation." 98 | fi 99 | else 100 | JAVACMD="java" 101 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 102 | 103 | Please set the JAVA_HOME variable in your environment to match the 104 | location of your Java installation." 105 | fi 106 | 107 | # Increase the maximum file descriptors if we can. 108 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ]; then 109 | MAX_FD_LIMIT=$(ulimit -H -n) 110 | if [ $? -eq 0 ]; then 111 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ]; then 112 | MAX_FD="$MAX_FD_LIMIT" 113 | fi 114 | ulimit -n $MAX_FD 115 | if [ $? -ne 0 ]; then 116 | warn "Could not set maximum file descriptor limit: $MAX_FD" 117 | fi 118 | else 119 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 120 | fi 121 | fi 122 | 123 | # For Darwin, add options to specify how the application appears in the dock 124 | if $darwin; then 125 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 126 | fi 127 | 128 | # For Cygwin or MSYS, switch paths to Windows format before running java 129 | if [ "$cygwin" = "true" -o "$msys" = "true" ]; then 130 | APP_HOME=$(cygpath --path --mixed "$APP_HOME") 131 | CLASSPATH=$(cygpath --path --mixed "$CLASSPATH") 132 | 133 | JAVACMD=$(cygpath --unix "$JAVACMD") 134 | 135 | # We build the pattern for arguments to be converted via cygpath 136 | ROOTDIRSRAW=$(find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null) 137 | SEP="" 138 | for dir in $ROOTDIRSRAW; do 139 | ROOTDIRS="$ROOTDIRS$SEP$dir" 140 | SEP="|" 141 | done 142 | OURCYGPATTERN="(^($ROOTDIRS))" 143 | # Add a user-defined pattern to the cygpath arguments 144 | if [ "$GRADLE_CYGPATTERN" != "" ]; then 145 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 146 | fi 147 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 148 | i=0 149 | for arg in "$@"; do 150 | CHECK=$(echo "$arg" | egrep -c "$OURCYGPATTERN" -) 151 | CHECK2=$(echo "$arg" | egrep -c "^-") ### Determine if an option 152 | 153 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ]; then ### Added a condition 154 | eval $(echo args$i)=$(cygpath --path --ignore --mixed "$arg") 155 | else 156 | eval $(echo args$i)="\"$arg\"" 157 | fi 158 | i=$(expr $i + 1) 159 | done 160 | case $i in 161 | 0) set -- ;; 162 | 1) set -- "$args0" ;; 163 | 2) set -- "$args0" "$args1" ;; 164 | 3) set -- "$args0" "$args1" "$args2" ;; 165 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;; 166 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 167 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 168 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 169 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 170 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 171 | esac 172 | fi 173 | 174 | # Escape application args 175 | save() { 176 | for i; do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/"; done 177 | echo " " 178 | } 179 | APP_ARGS=$(save "$@") 180 | 181 | # Collect all arguments for the java command, following the shell quoting and substitution rules 182 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 183 | 184 | exec "$JAVACMD" "$@" 185 | -------------------------------------------------------------------------------- /spring-sockets-1/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ]; do 30 | ls=$(ls -ld "$PRG") 31 | link=$(expr "$ls" : '.*-> \(.*\)$') 32 | if expr "$link" : '/.*' >/dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=$(dirname "$PRG")"/$link" 36 | fi 37 | done 38 | SAVED="$(pwd)" 39 | cd "$(dirname \"$PRG\")/" >/dev/null 40 | APP_HOME="$(pwd -P)" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=$(basename "$0") 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn() { 53 | echo "$*" 54 | } 55 | 56 | die() { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "$(uname)" in 69 | CYGWIN*) 70 | cygwin=true 71 | ;; 72 | Darwin*) 73 | darwin=true 74 | ;; 75 | MSYS* | MINGW*) 76 | msys=true 77 | ;; 78 | NONSTOP*) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | # Determine the Java command to use to start the JVM. 86 | if [ -n "$JAVA_HOME" ]; then 87 | if [ -x "$JAVA_HOME/jre/sh/java" ]; then 88 | # IBM's JDK on AIX uses strange locations for the executables 89 | JAVACMD="$JAVA_HOME/jre/sh/java" 90 | else 91 | JAVACMD="$JAVA_HOME/bin/java" 92 | fi 93 | if [ ! -x "$JAVACMD" ]; then 94 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 95 | 96 | Please set the JAVA_HOME variable in your environment to match the 97 | location of your Java installation." 98 | fi 99 | else 100 | JAVACMD="java" 101 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 102 | 103 | Please set the JAVA_HOME variable in your environment to match the 104 | location of your Java installation." 105 | fi 106 | 107 | # Increase the maximum file descriptors if we can. 108 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ]; then 109 | MAX_FD_LIMIT=$(ulimit -H -n) 110 | if [ $? -eq 0 ]; then 111 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ]; then 112 | MAX_FD="$MAX_FD_LIMIT" 113 | fi 114 | ulimit -n $MAX_FD 115 | if [ $? -ne 0 ]; then 116 | warn "Could not set maximum file descriptor limit: $MAX_FD" 117 | fi 118 | else 119 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 120 | fi 121 | fi 122 | 123 | # For Darwin, add options to specify how the application appears in the dock 124 | if $darwin; then 125 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 126 | fi 127 | 128 | # For Cygwin or MSYS, switch paths to Windows format before running java 129 | if [ "$cygwin" = "true" -o "$msys" = "true" ]; then 130 | APP_HOME=$(cygpath --path --mixed "$APP_HOME") 131 | CLASSPATH=$(cygpath --path --mixed "$CLASSPATH") 132 | 133 | JAVACMD=$(cygpath --unix "$JAVACMD") 134 | 135 | # We build the pattern for arguments to be converted via cygpath 136 | ROOTDIRSRAW=$(find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null) 137 | SEP="" 138 | for dir in $ROOTDIRSRAW; do 139 | ROOTDIRS="$ROOTDIRS$SEP$dir" 140 | SEP="|" 141 | done 142 | OURCYGPATTERN="(^($ROOTDIRS))" 143 | # Add a user-defined pattern to the cygpath arguments 144 | if [ "$GRADLE_CYGPATTERN" != "" ]; then 145 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 146 | fi 147 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 148 | i=0 149 | for arg in "$@"; do 150 | CHECK=$(echo "$arg" | egrep -c "$OURCYGPATTERN" -) 151 | CHECK2=$(echo "$arg" | egrep -c "^-") ### Determine if an option 152 | 153 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ]; then ### Added a condition 154 | eval $(echo args$i)=$(cygpath --path --ignore --mixed "$arg") 155 | else 156 | eval $(echo args$i)="\"$arg\"" 157 | fi 158 | i=$(expr $i + 1) 159 | done 160 | case $i in 161 | 0) set -- ;; 162 | 1) set -- "$args0" ;; 163 | 2) set -- "$args0" "$args1" ;; 164 | 3) set -- "$args0" "$args1" "$args2" ;; 165 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;; 166 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 167 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 168 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 169 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 170 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 171 | esac 172 | fi 173 | 174 | # Escape application args 175 | save() { 176 | for i; do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/"; done 177 | echo " " 178 | } 179 | APP_ARGS=$(save "$@") 180 | 181 | # Collect all arguments for the java command, following the shell quoting and substitution rules 182 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 183 | 184 | exec "$JAVACMD" "$@" 185 | -------------------------------------------------------------------------------- /springjpa-basics-1/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ]; do 30 | ls=$(ls -ld "$PRG") 31 | link=$(expr "$ls" : '.*-> \(.*\)$') 32 | if expr "$link" : '/.*' >/dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=$(dirname "$PRG")"/$link" 36 | fi 37 | done 38 | SAVED="$(pwd)" 39 | cd "$(dirname \"$PRG\")/" >/dev/null 40 | APP_HOME="$(pwd -P)" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=$(basename "$0") 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn() { 53 | echo "$*" 54 | } 55 | 56 | die() { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "$(uname)" in 69 | CYGWIN*) 70 | cygwin=true 71 | ;; 72 | Darwin*) 73 | darwin=true 74 | ;; 75 | MSYS* | MINGW*) 76 | msys=true 77 | ;; 78 | NONSTOP*) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | # Determine the Java command to use to start the JVM. 86 | if [ -n "$JAVA_HOME" ]; then 87 | if [ -x "$JAVA_HOME/jre/sh/java" ]; then 88 | # IBM's JDK on AIX uses strange locations for the executables 89 | JAVACMD="$JAVA_HOME/jre/sh/java" 90 | else 91 | JAVACMD="$JAVA_HOME/bin/java" 92 | fi 93 | if [ ! -x "$JAVACMD" ]; then 94 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 95 | 96 | Please set the JAVA_HOME variable in your environment to match the 97 | location of your Java installation." 98 | fi 99 | else 100 | JAVACMD="java" 101 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 102 | 103 | Please set the JAVA_HOME variable in your environment to match the 104 | location of your Java installation." 105 | fi 106 | 107 | # Increase the maximum file descriptors if we can. 108 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ]; then 109 | MAX_FD_LIMIT=$(ulimit -H -n) 110 | if [ $? -eq 0 ]; then 111 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ]; then 112 | MAX_FD="$MAX_FD_LIMIT" 113 | fi 114 | ulimit -n $MAX_FD 115 | if [ $? -ne 0 ]; then 116 | warn "Could not set maximum file descriptor limit: $MAX_FD" 117 | fi 118 | else 119 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 120 | fi 121 | fi 122 | 123 | # For Darwin, add options to specify how the application appears in the dock 124 | if $darwin; then 125 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 126 | fi 127 | 128 | # For Cygwin or MSYS, switch paths to Windows format before running java 129 | if [ "$cygwin" = "true" -o "$msys" = "true" ]; then 130 | APP_HOME=$(cygpath --path --mixed "$APP_HOME") 131 | CLASSPATH=$(cygpath --path --mixed "$CLASSPATH") 132 | 133 | JAVACMD=$(cygpath --unix "$JAVACMD") 134 | 135 | # We build the pattern for arguments to be converted via cygpath 136 | ROOTDIRSRAW=$(find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null) 137 | SEP="" 138 | for dir in $ROOTDIRSRAW; do 139 | ROOTDIRS="$ROOTDIRS$SEP$dir" 140 | SEP="|" 141 | done 142 | OURCYGPATTERN="(^($ROOTDIRS))" 143 | # Add a user-defined pattern to the cygpath arguments 144 | if [ "$GRADLE_CYGPATTERN" != "" ]; then 145 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 146 | fi 147 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 148 | i=0 149 | for arg in "$@"; do 150 | CHECK=$(echo "$arg" | egrep -c "$OURCYGPATTERN" -) 151 | CHECK2=$(echo "$arg" | egrep -c "^-") ### Determine if an option 152 | 153 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ]; then ### Added a condition 154 | eval $(echo args$i)=$(cygpath --path --ignore --mixed "$arg") 155 | else 156 | eval $(echo args$i)="\"$arg\"" 157 | fi 158 | i=$(expr $i + 1) 159 | done 160 | case $i in 161 | 0) set -- ;; 162 | 1) set -- "$args0" ;; 163 | 2) set -- "$args0" "$args1" ;; 164 | 3) set -- "$args0" "$args1" "$args2" ;; 165 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;; 166 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 167 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 168 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 169 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 170 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 171 | esac 172 | fi 173 | 174 | # Escape application args 175 | save() { 176 | for i; do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/"; done 177 | echo " " 178 | } 179 | APP_ARGS=$(save "$@") 180 | 181 | # Collect all arguments for the java command, following the shell quoting and substitution rules 182 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 183 | 184 | exec "$JAVACMD" "$@" 185 | -------------------------------------------------------------------------------- /01-JavaBasics/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | 86 | # Determine the Java command to use to start the JVM. 87 | if [ -n "$JAVA_HOME" ] ; then 88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 89 | # IBM's JDK on AIX uses strange locations for the executables 90 | JAVACMD="$JAVA_HOME/jre/sh/java" 91 | else 92 | JAVACMD="$JAVA_HOME/bin/java" 93 | fi 94 | if [ ! -x "$JAVACMD" ] ; then 95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 96 | 97 | Please set the JAVA_HOME variable in your environment to match the 98 | location of your Java installation." 99 | fi 100 | else 101 | JAVACMD="java" 102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 103 | 104 | Please set the JAVA_HOME variable in your environment to match the 105 | location of your Java installation." 106 | fi 107 | 108 | # Increase the maximum file descriptors if we can. 109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 110 | MAX_FD_LIMIT=`ulimit -H -n` 111 | if [ $? -eq 0 ] ; then 112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 113 | MAX_FD="$MAX_FD_LIMIT" 114 | fi 115 | ulimit -n $MAX_FD 116 | if [ $? -ne 0 ] ; then 117 | warn "Could not set maximum file descriptor limit: $MAX_FD" 118 | fi 119 | else 120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 121 | fi 122 | fi 123 | 124 | # For Darwin, add options to specify how the application appears in the dock 125 | if $darwin; then 126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 127 | fi 128 | 129 | # For Cygwin or MSYS, switch paths to Windows format before running java 130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then 131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 133 | 134 | JAVACMD=`cygpath --unix "$JAVACMD"` 135 | 136 | # We build the pattern for arguments to be converted via cygpath 137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 138 | SEP="" 139 | for dir in $ROOTDIRSRAW ; do 140 | ROOTDIRS="$ROOTDIRS$SEP$dir" 141 | SEP="|" 142 | done 143 | OURCYGPATTERN="(^($ROOTDIRS))" 144 | # Add a user-defined pattern to the cygpath arguments 145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 147 | fi 148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 149 | i=0 150 | for arg in "$@" ; do 151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 153 | 154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 156 | else 157 | eval `echo args$i`="\"$arg\"" 158 | fi 159 | i=`expr $i + 1` 160 | done 161 | case $i in 162 | 0) set -- ;; 163 | 1) set -- "$args0" ;; 164 | 2) set -- "$args0" "$args1" ;; 165 | 3) set -- "$args0" "$args1" "$args2" ;; 166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;; 167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 172 | esac 173 | fi 174 | 175 | # Escape application args 176 | save () { 177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 178 | echo " " 179 | } 180 | APP_ARGS=`save "$@"` 181 | 182 | # Collect all arguments for the java command, following the shell quoting and substitution rules 183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 184 | 185 | exec "$JAVACMD" "$@" 186 | -------------------------------------------------------------------------------- /pc-builder/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MSYS* | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | 86 | # Determine the Java command to use to start the JVM. 87 | if [ -n "$JAVA_HOME" ] ; then 88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 89 | # IBM's JDK on AIX uses strange locations for the executables 90 | JAVACMD="$JAVA_HOME/jre/sh/java" 91 | else 92 | JAVACMD="$JAVA_HOME/bin/java" 93 | fi 94 | if [ ! -x "$JAVACMD" ] ; then 95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 96 | 97 | Please set the JAVA_HOME variable in your environment to match the 98 | location of your Java installation." 99 | fi 100 | else 101 | JAVACMD="java" 102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 103 | 104 | Please set the JAVA_HOME variable in your environment to match the 105 | location of your Java installation." 106 | fi 107 | 108 | # Increase the maximum file descriptors if we can. 109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 110 | MAX_FD_LIMIT=`ulimit -H -n` 111 | if [ $? -eq 0 ] ; then 112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 113 | MAX_FD="$MAX_FD_LIMIT" 114 | fi 115 | ulimit -n $MAX_FD 116 | if [ $? -ne 0 ] ; then 117 | warn "Could not set maximum file descriptor limit: $MAX_FD" 118 | fi 119 | else 120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 121 | fi 122 | fi 123 | 124 | # For Darwin, add options to specify how the application appears in the dock 125 | if $darwin; then 126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 127 | fi 128 | 129 | # For Cygwin or MSYS, switch paths to Windows format before running java 130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then 131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 133 | 134 | JAVACMD=`cygpath --unix "$JAVACMD"` 135 | 136 | # We build the pattern for arguments to be converted via cygpath 137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 138 | SEP="" 139 | for dir in $ROOTDIRSRAW ; do 140 | ROOTDIRS="$ROOTDIRS$SEP$dir" 141 | SEP="|" 142 | done 143 | OURCYGPATTERN="(^($ROOTDIRS))" 144 | # Add a user-defined pattern to the cygpath arguments 145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 147 | fi 148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 149 | i=0 150 | for arg in "$@" ; do 151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 153 | 154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 156 | else 157 | eval `echo args$i`="\"$arg\"" 158 | fi 159 | i=`expr $i + 1` 160 | done 161 | case $i in 162 | 0) set -- ;; 163 | 1) set -- "$args0" ;; 164 | 2) set -- "$args0" "$args1" ;; 165 | 3) set -- "$args0" "$args1" "$args2" ;; 166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;; 167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 172 | esac 173 | fi 174 | 175 | # Escape application args 176 | save () { 177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 178 | echo " " 179 | } 180 | APP_ARGS=`save "$@"` 181 | 182 | # Collect all arguments for the java command, following the shell quoting and substitution rules 183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 184 | 185 | exec "$JAVACMD" "$@" 186 | -------------------------------------------------------------------------------- /springbasics/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MSYS* | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | 86 | # Determine the Java command to use to start the JVM. 87 | if [ -n "$JAVA_HOME" ] ; then 88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 89 | # IBM's JDK on AIX uses strange locations for the executables 90 | JAVACMD="$JAVA_HOME/jre/sh/java" 91 | else 92 | JAVACMD="$JAVA_HOME/bin/java" 93 | fi 94 | if [ ! -x "$JAVACMD" ] ; then 95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 96 | 97 | Please set the JAVA_HOME variable in your environment to match the 98 | location of your Java installation." 99 | fi 100 | else 101 | JAVACMD="java" 102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 103 | 104 | Please set the JAVA_HOME variable in your environment to match the 105 | location of your Java installation." 106 | fi 107 | 108 | # Increase the maximum file descriptors if we can. 109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 110 | MAX_FD_LIMIT=`ulimit -H -n` 111 | if [ $? -eq 0 ] ; then 112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 113 | MAX_FD="$MAX_FD_LIMIT" 114 | fi 115 | ulimit -n $MAX_FD 116 | if [ $? -ne 0 ] ; then 117 | warn "Could not set maximum file descriptor limit: $MAX_FD" 118 | fi 119 | else 120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 121 | fi 122 | fi 123 | 124 | # For Darwin, add options to specify how the application appears in the dock 125 | if $darwin; then 126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 127 | fi 128 | 129 | # For Cygwin or MSYS, switch paths to Windows format before running java 130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then 131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 133 | 134 | JAVACMD=`cygpath --unix "$JAVACMD"` 135 | 136 | # We build the pattern for arguments to be converted via cygpath 137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 138 | SEP="" 139 | for dir in $ROOTDIRSRAW ; do 140 | ROOTDIRS="$ROOTDIRS$SEP$dir" 141 | SEP="|" 142 | done 143 | OURCYGPATTERN="(^($ROOTDIRS))" 144 | # Add a user-defined pattern to the cygpath arguments 145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 147 | fi 148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 149 | i=0 150 | for arg in "$@" ; do 151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 153 | 154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 156 | else 157 | eval `echo args$i`="\"$arg\"" 158 | fi 159 | i=`expr $i + 1` 160 | done 161 | case $i in 162 | 0) set -- ;; 163 | 1) set -- "$args0" ;; 164 | 2) set -- "$args0" "$args1" ;; 165 | 3) set -- "$args0" "$args1" "$args2" ;; 166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;; 167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 172 | esac 173 | fi 174 | 175 | # Escape application args 176 | save () { 177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 178 | echo " " 179 | } 180 | APP_ARGS=`save "$@"` 181 | 182 | # Collect all arguments for the java command, following the shell quoting and substitution rules 183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 184 | 185 | exec "$JAVACMD" "$@" 186 | -------------------------------------------------------------------------------- /springjpa-basics-1/test.db.trace.db: -------------------------------------------------------------------------------- 1 | 2021-08-04 16:16:24 database: flush 2 | org.h2.message.DbException: General error: "java.lang.IllegalStateException: The file is locked: nio:/Users/championswimmer/Development/Scaler/Oct-Nov-Dec-Projects/springjpa-basics-1/test.db.mv.db [1.4.200/7]" [50000-200] 3 | at org.h2.message.DbException.get(DbException.java:194) 4 | at org.h2.message.DbException.convert(DbException.java:347) 5 | at org.h2.mvstore.db.MVTableEngine$1.uncaughtException(MVTableEngine.java:93) 6 | at org.h2.mvstore.MVStore.handleException(MVStore.java:2877) 7 | at org.h2.mvstore.MVStore.panic(MVStore.java:481) 8 | at org.h2.mvstore.MVStore.(MVStore.java:402) 9 | at org.h2.mvstore.MVStore$Builder.open(MVStore.java:3579) 10 | at org.h2.mvstore.db.MVTableEngine$Store.open(MVTableEngine.java:170) 11 | at org.h2.mvstore.db.MVTableEngine.init(MVTableEngine.java:103) 12 | at org.h2.engine.Database.getPageStore(Database.java:2659) 13 | at org.h2.engine.Database.open(Database.java:675) 14 | at org.h2.engine.Database.openDatabase(Database.java:307) 15 | at org.h2.engine.Database.(Database.java:301) 16 | at org.h2.engine.Engine.openSession(Engine.java:74) 17 | at org.h2.engine.Engine.openSession(Engine.java:192) 18 | at org.h2.engine.Engine.createSessionAndValidate(Engine.java:171) 19 | at org.h2.engine.Engine.createSession(Engine.java:166) 20 | at org.h2.engine.Engine.createSession(Engine.java:29) 21 | at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:340) 22 | at org.h2.jdbc.JdbcConnection.(JdbcConnection.java:173) 23 | at org.h2.jdbc.JdbcConnection.(JdbcConnection.java:152) 24 | at org.h2.Driver.connect(Driver.java:69) 25 | at com.intellij.database.remote.jdbc.helpers.JdbcHelperImpl.connect(JdbcHelperImpl.java:617) 26 | at com.intellij.database.remote.jdbc.impl.RemoteDriverImpl.connect(RemoteDriverImpl.java:43) 27 | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 28 | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 29 | at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 30 | at java.base/java.lang.reflect.Method.invoke(Method.java:566) 31 | at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359) 32 | at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200) 33 | at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197) 34 | at java.base/java.security.AccessController.doPrivileged(Native Method) 35 | at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196) 36 | at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562) 37 | at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796) 38 | at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677) 39 | at java.base/java.security.AccessController.doPrivileged(Native Method) 40 | at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676) 41 | at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) 42 | at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) 43 | at java.base/java.lang.Thread.run(Thread.java:829) 44 | Caused by: org.h2.jdbc.JdbcSQLNonTransientException: General error: "java.lang.IllegalStateException: The file is locked: nio:/Users/championswimmer/Development/Scaler/Oct-Nov-Dec-Projects/springjpa-basics-1/test.db.mv.db [1.4.200/7]" [50000-200] 45 | at org.h2.message.DbException.getJdbcSQLException(DbException.java:505) 46 | at org.h2.message.DbException.getJdbcSQLException(DbException.java:429) 47 | ... 41 more 48 | Caused by: java.lang.IllegalStateException: The file is locked: nio:/Users/championswimmer/Development/Scaler/Oct-Nov-Dec-Projects/springjpa-basics-1/test.db.mv.db [1.4.200/7] 49 | at org.h2.mvstore.DataUtils.newIllegalStateException(DataUtils.java:950) 50 | at org.h2.mvstore.FileStore.open(FileStore.java:172) 51 | at org.h2.mvstore.MVStore.(MVStore.java:381) 52 | ... 35 more 53 | 2021-08-04 16:16:24 database: flush 54 | org.h2.message.DbException: General error: "java.lang.IllegalStateException: The file is locked: nio:/Users/championswimmer/Development/Scaler/Oct-Nov-Dec-Projects/springjpa-basics-1/test.db.mv.db [1.4.200/7]" [50000-200] 55 | at org.h2.message.DbException.get(DbException.java:194) 56 | at org.h2.message.DbException.convert(DbException.java:347) 57 | at org.h2.mvstore.db.MVTableEngine$1.uncaughtException(MVTableEngine.java:93) 58 | at org.h2.mvstore.MVStore.handleException(MVStore.java:2877) 59 | at org.h2.mvstore.MVStore.panic(MVStore.java:481) 60 | at org.h2.mvstore.MVStore.(MVStore.java:402) 61 | at org.h2.mvstore.MVStore$Builder.open(MVStore.java:3579) 62 | at org.h2.mvstore.db.MVTableEngine$Store.open(MVTableEngine.java:170) 63 | at org.h2.mvstore.db.MVTableEngine.init(MVTableEngine.java:103) 64 | at org.h2.engine.Database.getPageStore(Database.java:2659) 65 | at org.h2.engine.Database.open(Database.java:675) 66 | at org.h2.engine.Database.openDatabase(Database.java:307) 67 | at org.h2.engine.Database.(Database.java:301) 68 | at org.h2.engine.Engine.openSession(Engine.java:74) 69 | at org.h2.engine.Engine.openSession(Engine.java:192) 70 | at org.h2.engine.Engine.createSessionAndValidate(Engine.java:171) 71 | at org.h2.engine.Engine.createSession(Engine.java:166) 72 | at org.h2.engine.Engine.createSession(Engine.java:29) 73 | at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:340) 74 | at org.h2.jdbc.JdbcConnection.(JdbcConnection.java:173) 75 | at org.h2.jdbc.JdbcConnection.(JdbcConnection.java:152) 76 | at org.h2.Driver.connect(Driver.java:69) 77 | at com.intellij.database.remote.jdbc.helpers.JdbcHelperImpl.connect(JdbcHelperImpl.java:617) 78 | at com.intellij.database.remote.jdbc.impl.RemoteDriverImpl.connect(RemoteDriverImpl.java:43) 79 | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 80 | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 81 | at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 82 | at java.base/java.lang.reflect.Method.invoke(Method.java:566) 83 | at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359) 84 | at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200) 85 | at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197) 86 | at java.base/java.security.AccessController.doPrivileged(Native Method) 87 | at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196) 88 | at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562) 89 | at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796) 90 | at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677) 91 | at java.base/java.security.AccessController.doPrivileged(Native Method) 92 | at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676) 93 | at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) 94 | at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) 95 | at java.base/java.lang.Thread.run(Thread.java:829) 96 | Caused by: org.h2.jdbc.JdbcSQLNonTransientException: General error: "java.lang.IllegalStateException: The file is locked: nio:/Users/championswimmer/Development/Scaler/Oct-Nov-Dec-Projects/springjpa-basics-1/test.db.mv.db [1.4.200/7]" [50000-200] 97 | at org.h2.message.DbException.getJdbcSQLException(DbException.java:505) 98 | at org.h2.message.DbException.getJdbcSQLException(DbException.java:429) 99 | ... 41 more 100 | Caused by: java.lang.IllegalStateException: The file is locked: nio:/Users/championswimmer/Development/Scaler/Oct-Nov-Dec-Projects/springjpa-basics-1/test.db.mv.db [1.4.200/7] 101 | at org.h2.mvstore.DataUtils.newIllegalStateException(DataUtils.java:950) 102 | at org.h2.mvstore.FileStore.open(FileStore.java:172) 103 | at org.h2.mvstore.MVStore.(MVStore.java:381) 104 | ... 35 more 105 | 2021-08-04 16:16:35 jdbc[3]: exception 106 | java.sql.SQLClientInfoException: Client info name 'ApplicationName' not supported. 107 | at org.h2.jdbc.JdbcConnection.setClientInfo(JdbcConnection.java:1749) 108 | at com.intellij.database.remote.jdbc.impl.RemoteConnectionImpl.setClientInfo(RemoteConnectionImpl.java:466) 109 | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 110 | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 111 | at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 112 | at java.base/java.lang.reflect.Method.invoke(Method.java:566) 113 | at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359) 114 | at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200) 115 | at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197) 116 | at java.base/java.security.AccessController.doPrivileged(Native Method) 117 | at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196) 118 | at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562) 119 | at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796) 120 | at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677) 121 | at java.base/java.security.AccessController.doPrivileged(Native Method) 122 | at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676) 123 | at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) 124 | at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) 125 | at java.base/java.lang.Thread.run(Thread.java:829) 126 | 2021-08-04 16:16:43 jdbc[3]: exception 127 | java.sql.SQLClientInfoException: Client info name 'ApplicationName' not supported. 128 | at org.h2.jdbc.JdbcConnection.setClientInfo(JdbcConnection.java:1749) 129 | at com.intellij.database.remote.jdbc.impl.RemoteConnectionImpl.setClientInfo(RemoteConnectionImpl.java:466) 130 | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 131 | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 132 | at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 133 | at java.base/java.lang.reflect.Method.invoke(Method.java:566) 134 | at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359) 135 | at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200) 136 | at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197) 137 | at java.base/java.security.AccessController.doPrivileged(Native Method) 138 | at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196) 139 | at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562) 140 | at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796) 141 | at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677) 142 | at java.base/java.security.AccessController.doPrivileged(Native Method) 143 | at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676) 144 | at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) 145 | at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) 146 | at java.base/java.lang.Thread.run(Thread.java:829) 147 | 2021-08-04 21:46:53 database: flush 148 | org.h2.message.DbException: General error: "java.lang.IllegalStateException: The file is locked: nio:/Users/championswimmer/Development/Scaler/Oct-Nov-Dec-Projects/springjpa-basics-1/test.db.mv.db [1.4.200/7]" [50000-200] 149 | at org.h2.message.DbException.get(DbException.java:194) 150 | at org.h2.message.DbException.convert(DbException.java:347) 151 | at org.h2.mvstore.db.MVTableEngine$1.uncaughtException(MVTableEngine.java:93) 152 | at org.h2.mvstore.MVStore.handleException(MVStore.java:2877) 153 | at org.h2.mvstore.MVStore.panic(MVStore.java:481) 154 | at org.h2.mvstore.MVStore.(MVStore.java:402) 155 | at org.h2.mvstore.MVStore$Builder.open(MVStore.java:3579) 156 | at org.h2.mvstore.db.MVTableEngine$Store.open(MVTableEngine.java:170) 157 | at org.h2.mvstore.db.MVTableEngine.init(MVTableEngine.java:103) 158 | at org.h2.engine.Database.getPageStore(Database.java:2659) 159 | at org.h2.engine.Database.open(Database.java:675) 160 | at org.h2.engine.Database.openDatabase(Database.java:307) 161 | at org.h2.engine.Database.(Database.java:301) 162 | at org.h2.engine.Engine.openSession(Engine.java:74) 163 | at org.h2.engine.Engine.openSession(Engine.java:192) 164 | at org.h2.engine.Engine.createSessionAndValidate(Engine.java:171) 165 | at org.h2.engine.Engine.createSession(Engine.java:166) 166 | at org.h2.engine.Engine.createSession(Engine.java:29) 167 | at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:340) 168 | at org.h2.jdbc.JdbcConnection.(JdbcConnection.java:173) 169 | at org.h2.jdbc.JdbcConnection.(JdbcConnection.java:152) 170 | at org.h2.Driver.connect(Driver.java:69) 171 | at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:121) 172 | at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:364) 173 | at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:206) 174 | at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:476) 175 | at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561) 176 | at com.zaxxer.hikari.pool.HikariPool.(HikariPool.java:115) 177 | at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112) 178 | at org.springframework.boot.autoconfigure.h2.H2ConsoleAutoConfiguration.lambda$h2Console$0(H2ConsoleAutoConfiguration.java:67) 179 | at org.springframework.beans.factory.support.DefaultListableBeanFactory$DependencyObjectProvider.ifAvailable(DefaultListableBeanFactory.java:2035) 180 | at org.springframework.boot.autoconfigure.h2.H2ConsoleAutoConfiguration.h2Console(H2ConsoleAutoConfiguration.java:66) 181 | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 182 | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 183 | at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 184 | at java.base/java.lang.reflect.Method.invoke(Method.java:566) 185 | at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) 186 | at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653) 187 | at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:638) 188 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1334) 189 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177) 190 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:564) 191 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524) 192 | at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) 193 | at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) 194 | at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) 195 | at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:213) 196 | at org.springframework.boot.web.servlet.ServletContextInitializerBeans.getOrderedBeansOfType(ServletContextInitializerBeans.java:212) 197 | at org.springframework.boot.web.servlet.ServletContextInitializerBeans.getOrderedBeansOfType(ServletContextInitializerBeans.java:203) 198 | at org.springframework.boot.web.servlet.ServletContextInitializerBeans.addServletContextInitializerBeans(ServletContextInitializerBeans.java:97) 199 | at org.springframework.boot.web.servlet.ServletContextInitializerBeans.(ServletContextInitializerBeans.java:86) 200 | at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.getServletContextInitializerBeans(ServletWebServerApplicationContext.java:260) 201 | at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.selfInitialize(ServletWebServerApplicationContext.java:234) 202 | at org.springframework.boot.web.embedded.tomcat.TomcatStarter.onStartup(TomcatStarter.java:53) 203 | at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5219) 204 | at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) 205 | at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398) 206 | at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1388) 207 | at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) 208 | at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) 209 | at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140) 210 | at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:921) 211 | at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:835) 212 | at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) 213 | at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398) 214 | at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1388) 215 | at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) 216 | at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) 217 | at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140) 218 | at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:921) 219 | at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:263) 220 | at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) 221 | at org.apache.catalina.core.StandardService.startInternal(StandardService.java:437) 222 | at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) 223 | at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:934) 224 | at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) 225 | at org.apache.catalina.startup.Tomcat.start(Tomcat.java:486) 226 | at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:123) 227 | at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.(TomcatWebServer.java:104) 228 | at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:450) 229 | at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:199) 230 | at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:182) 231 | at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:160) 232 | at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:577) 233 | at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) 234 | at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) 235 | at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) 236 | at org.springframework.boot.SpringApplication.run(SpringApplication.java:338) 237 | at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) 238 | at org.springframework.boot.SpringApplication.run(SpringApplication.java:1332) 239 | at com.example.springjpabasics1.SpringjpaBasics1Application.main(SpringjpaBasics1Application.java:10) 240 | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 241 | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 242 | at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 243 | at java.base/java.lang.reflect.Method.invoke(Method.java:566) 244 | at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) 245 | Caused by: org.h2.jdbc.JdbcSQLNonTransientException: General error: "java.lang.IllegalStateException: The file is locked: nio:/Users/championswimmer/Development/Scaler/Oct-Nov-Dec-Projects/springjpa-basics-1/test.db.mv.db [1.4.200/7]" [50000-200] 246 | at org.h2.message.DbException.getJdbcSQLException(DbException.java:505) 247 | at org.h2.message.DbException.getJdbcSQLException(DbException.java:429) 248 | ... 96 more 249 | Caused by: java.lang.IllegalStateException: The file is locked: nio:/Users/championswimmer/Development/Scaler/Oct-Nov-Dec-Projects/springjpa-basics-1/test.db.mv.db [1.4.200/7] 250 | at org.h2.mvstore.DataUtils.newIllegalStateException(DataUtils.java:950) 251 | at org.h2.mvstore.FileStore.open(FileStore.java:172) 252 | at org.h2.mvstore.MVStore.(MVStore.java:381) 253 | ... 90 more 254 | 2021-08-04 21:46:55 database: flush 255 | org.h2.message.DbException: General error: "java.lang.IllegalStateException: The file is locked: nio:/Users/championswimmer/Development/Scaler/Oct-Nov-Dec-Projects/springjpa-basics-1/test.db.mv.db [1.4.200/7]" [50000-200] 256 | at org.h2.message.DbException.get(DbException.java:194) 257 | at org.h2.message.DbException.convert(DbException.java:347) 258 | at org.h2.mvstore.db.MVTableEngine$1.uncaughtException(MVTableEngine.java:93) 259 | at org.h2.mvstore.MVStore.handleException(MVStore.java:2877) 260 | at org.h2.mvstore.MVStore.panic(MVStore.java:481) 261 | at org.h2.mvstore.MVStore.(MVStore.java:402) 262 | at org.h2.mvstore.MVStore$Builder.open(MVStore.java:3579) 263 | at org.h2.mvstore.db.MVTableEngine$Store.open(MVTableEngine.java:170) 264 | at org.h2.mvstore.db.MVTableEngine.init(MVTableEngine.java:103) 265 | at org.h2.engine.Database.getPageStore(Database.java:2659) 266 | at org.h2.engine.Database.open(Database.java:675) 267 | at org.h2.engine.Database.openDatabase(Database.java:307) 268 | at org.h2.engine.Database.(Database.java:301) 269 | at org.h2.engine.Engine.openSession(Engine.java:74) 270 | at org.h2.engine.Engine.openSession(Engine.java:192) 271 | at org.h2.engine.Engine.createSessionAndValidate(Engine.java:171) 272 | at org.h2.engine.Engine.createSession(Engine.java:166) 273 | at org.h2.engine.Engine.createSession(Engine.java:29) 274 | at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:340) 275 | at org.h2.jdbc.JdbcConnection.(JdbcConnection.java:173) 276 | at org.h2.jdbc.JdbcConnection.(JdbcConnection.java:152) 277 | at org.h2.Driver.connect(Driver.java:69) 278 | at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:121) 279 | at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:364) 280 | at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:206) 281 | at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:476) 282 | at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561) 283 | at com.zaxxer.hikari.pool.HikariPool.(HikariPool.java:115) 284 | at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112) 285 | at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:122) 286 | at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcEnvironmentInitiator.java:180) 287 | at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:68) 288 | at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:35) 289 | at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:101) 290 | at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:263) 291 | at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:237) 292 | at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214) 293 | at org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory.injectServices(DefaultIdentifierGeneratorFactory.java:152) 294 | at org.hibernate.service.internal.AbstractServiceRegistryImpl.injectDependencies(AbstractServiceRegistryImpl.java:286) 295 | at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:243) 296 | at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214) 297 | at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.(InFlightMetadataCollectorImpl.java:176) 298 | at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:127) 299 | at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1224) 300 | at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1255) 301 | at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:58) 302 | at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:365) 303 | at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409) 304 | at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396) 305 | at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341) 306 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1845) 307 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1782) 308 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:602) 309 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524) 310 | at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) 311 | at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) 312 | at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) 313 | at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) 314 | at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1154) 315 | at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:908) 316 | at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) 317 | at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) 318 | at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) 319 | at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) 320 | at org.springframework.boot.SpringApplication.run(SpringApplication.java:338) 321 | at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) 322 | at org.springframework.boot.SpringApplication.run(SpringApplication.java:1332) 323 | at com.example.springjpabasics1.SpringjpaBasics1Application.main(SpringjpaBasics1Application.java:10) 324 | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 325 | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 326 | at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 327 | at java.base/java.lang.reflect.Method.invoke(Method.java:566) 328 | at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) 329 | Caused by: org.h2.jdbc.JdbcSQLNonTransientException: General error: "java.lang.IllegalStateException: The file is locked: nio:/Users/championswimmer/Development/Scaler/Oct-Nov-Dec-Projects/springjpa-basics-1/test.db.mv.db [1.4.200/7]" [50000-200] 330 | at org.h2.message.DbException.getJdbcSQLException(DbException.java:505) 331 | at org.h2.message.DbException.getJdbcSQLException(DbException.java:429) 332 | ... 73 more 333 | Caused by: java.lang.IllegalStateException: The file is locked: nio:/Users/championswimmer/Development/Scaler/Oct-Nov-Dec-Projects/springjpa-basics-1/test.db.mv.db [1.4.200/7] 334 | at org.h2.mvstore.DataUtils.newIllegalStateException(DataUtils.java:950) 335 | at org.h2.mvstore.FileStore.open(FileStore.java:172) 336 | at org.h2.mvstore.MVStore.(MVStore.java:381) 337 | ... 67 more 338 | 2021-08-04 21:47:06 database: flush 339 | org.h2.message.DbException: General error: "java.lang.IllegalStateException: The file is locked: nio:/Users/championswimmer/Development/Scaler/Oct-Nov-Dec-Projects/springjpa-basics-1/test.db.mv.db [1.4.200/7]" [50000-200] 340 | at org.h2.message.DbException.get(DbException.java:194) 341 | at org.h2.message.DbException.convert(DbException.java:347) 342 | at org.h2.mvstore.db.MVTableEngine$1.uncaughtException(MVTableEngine.java:93) 343 | at org.h2.mvstore.MVStore.handleException(MVStore.java:2877) 344 | at org.h2.mvstore.MVStore.panic(MVStore.java:481) 345 | at org.h2.mvstore.MVStore.(MVStore.java:402) 346 | at org.h2.mvstore.MVStore$Builder.open(MVStore.java:3579) 347 | at org.h2.mvstore.db.MVTableEngine$Store.open(MVTableEngine.java:170) 348 | at org.h2.mvstore.db.MVTableEngine.init(MVTableEngine.java:103) 349 | at org.h2.engine.Database.getPageStore(Database.java:2659) 350 | at org.h2.engine.Database.open(Database.java:675) 351 | at org.h2.engine.Database.openDatabase(Database.java:307) 352 | at org.h2.engine.Database.(Database.java:301) 353 | at org.h2.engine.Engine.openSession(Engine.java:74) 354 | at org.h2.engine.Engine.openSession(Engine.java:192) 355 | at org.h2.engine.Engine.createSessionAndValidate(Engine.java:171) 356 | at org.h2.engine.Engine.createSession(Engine.java:166) 357 | at org.h2.engine.Engine.createSession(Engine.java:29) 358 | at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:340) 359 | at org.h2.jdbc.JdbcConnection.(JdbcConnection.java:173) 360 | at org.h2.jdbc.JdbcConnection.(JdbcConnection.java:152) 361 | at org.h2.Driver.connect(Driver.java:69) 362 | at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:121) 363 | at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:364) 364 | at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:206) 365 | at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:476) 366 | at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561) 367 | at com.zaxxer.hikari.pool.HikariPool.(HikariPool.java:115) 368 | at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112) 369 | at org.springframework.boot.autoconfigure.h2.H2ConsoleAutoConfiguration.lambda$h2Console$0(H2ConsoleAutoConfiguration.java:67) 370 | at org.springframework.beans.factory.support.DefaultListableBeanFactory$DependencyObjectProvider.ifAvailable(DefaultListableBeanFactory.java:2035) 371 | at org.springframework.boot.autoconfigure.h2.H2ConsoleAutoConfiguration.h2Console(H2ConsoleAutoConfiguration.java:66) 372 | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 373 | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 374 | at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 375 | at java.base/java.lang.reflect.Method.invoke(Method.java:566) 376 | at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) 377 | at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653) 378 | at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:638) 379 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1334) 380 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177) 381 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:564) 382 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524) 383 | at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) 384 | at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) 385 | at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) 386 | at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:213) 387 | at org.springframework.boot.web.servlet.ServletContextInitializerBeans.getOrderedBeansOfType(ServletContextInitializerBeans.java:212) 388 | at org.springframework.boot.web.servlet.ServletContextInitializerBeans.getOrderedBeansOfType(ServletContextInitializerBeans.java:203) 389 | at org.springframework.boot.web.servlet.ServletContextInitializerBeans.addServletContextInitializerBeans(ServletContextInitializerBeans.java:97) 390 | at org.springframework.boot.web.servlet.ServletContextInitializerBeans.(ServletContextInitializerBeans.java:86) 391 | at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.getServletContextInitializerBeans(ServletWebServerApplicationContext.java:260) 392 | at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.selfInitialize(ServletWebServerApplicationContext.java:234) 393 | at org.springframework.boot.web.embedded.tomcat.TomcatStarter.onStartup(TomcatStarter.java:53) 394 | at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5219) 395 | at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) 396 | at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398) 397 | at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1388) 398 | at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) 399 | at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) 400 | at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140) 401 | at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:921) 402 | at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:835) 403 | at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) 404 | at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398) 405 | at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1388) 406 | at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) 407 | at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) 408 | at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140) 409 | at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:921) 410 | at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:263) 411 | at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) 412 | at org.apache.catalina.core.StandardService.startInternal(StandardService.java:437) 413 | at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) 414 | at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:934) 415 | at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) 416 | at org.apache.catalina.startup.Tomcat.start(Tomcat.java:486) 417 | at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:123) 418 | at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.(TomcatWebServer.java:104) 419 | at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:450) 420 | at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:199) 421 | at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:182) 422 | at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:160) 423 | at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:577) 424 | at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) 425 | at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) 426 | at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) 427 | at org.springframework.boot.SpringApplication.run(SpringApplication.java:338) 428 | at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) 429 | at org.springframework.boot.SpringApplication.run(SpringApplication.java:1332) 430 | at com.example.springjpabasics1.SpringjpaBasics1Application.main(SpringjpaBasics1Application.java:10) 431 | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 432 | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 433 | at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 434 | at java.base/java.lang.reflect.Method.invoke(Method.java:566) 435 | at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) 436 | Caused by: org.h2.jdbc.JdbcSQLNonTransientException: General error: "java.lang.IllegalStateException: The file is locked: nio:/Users/championswimmer/Development/Scaler/Oct-Nov-Dec-Projects/springjpa-basics-1/test.db.mv.db [1.4.200/7]" [50000-200] 437 | at org.h2.message.DbException.getJdbcSQLException(DbException.java:505) 438 | at org.h2.message.DbException.getJdbcSQLException(DbException.java:429) 439 | ... 96 more 440 | Caused by: java.lang.IllegalStateException: The file is locked: nio:/Users/championswimmer/Development/Scaler/Oct-Nov-Dec-Projects/springjpa-basics-1/test.db.mv.db [1.4.200/7] 441 | at org.h2.mvstore.DataUtils.newIllegalStateException(DataUtils.java:950) 442 | at org.h2.mvstore.FileStore.open(FileStore.java:172) 443 | at org.h2.mvstore.MVStore.(MVStore.java:381) 444 | ... 90 more 445 | 2021-08-04 21:47:08 database: flush 446 | org.h2.message.DbException: General error: "java.lang.IllegalStateException: The file is locked: nio:/Users/championswimmer/Development/Scaler/Oct-Nov-Dec-Projects/springjpa-basics-1/test.db.mv.db [1.4.200/7]" [50000-200] 447 | at org.h2.message.DbException.get(DbException.java:194) 448 | at org.h2.message.DbException.convert(DbException.java:347) 449 | at org.h2.mvstore.db.MVTableEngine$1.uncaughtException(MVTableEngine.java:93) 450 | at org.h2.mvstore.MVStore.handleException(MVStore.java:2877) 451 | at org.h2.mvstore.MVStore.panic(MVStore.java:481) 452 | at org.h2.mvstore.MVStore.(MVStore.java:402) 453 | at org.h2.mvstore.MVStore$Builder.open(MVStore.java:3579) 454 | at org.h2.mvstore.db.MVTableEngine$Store.open(MVTableEngine.java:170) 455 | at org.h2.mvstore.db.MVTableEngine.init(MVTableEngine.java:103) 456 | at org.h2.engine.Database.getPageStore(Database.java:2659) 457 | at org.h2.engine.Database.open(Database.java:675) 458 | at org.h2.engine.Database.openDatabase(Database.java:307) 459 | at org.h2.engine.Database.(Database.java:301) 460 | at org.h2.engine.Engine.openSession(Engine.java:74) 461 | at org.h2.engine.Engine.openSession(Engine.java:192) 462 | at org.h2.engine.Engine.createSessionAndValidate(Engine.java:171) 463 | at org.h2.engine.Engine.createSession(Engine.java:166) 464 | at org.h2.engine.Engine.createSession(Engine.java:29) 465 | at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:340) 466 | at org.h2.jdbc.JdbcConnection.(JdbcConnection.java:173) 467 | at org.h2.jdbc.JdbcConnection.(JdbcConnection.java:152) 468 | at org.h2.Driver.connect(Driver.java:69) 469 | at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:121) 470 | at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:364) 471 | at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:206) 472 | at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:476) 473 | at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561) 474 | at com.zaxxer.hikari.pool.HikariPool.(HikariPool.java:115) 475 | at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112) 476 | at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:122) 477 | at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcEnvironmentInitiator.java:180) 478 | at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:68) 479 | at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:35) 480 | at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:101) 481 | at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:263) 482 | at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:237) 483 | at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214) 484 | at org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory.injectServices(DefaultIdentifierGeneratorFactory.java:152) 485 | at org.hibernate.service.internal.AbstractServiceRegistryImpl.injectDependencies(AbstractServiceRegistryImpl.java:286) 486 | at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:243) 487 | at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214) 488 | at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.(InFlightMetadataCollectorImpl.java:176) 489 | at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:127) 490 | at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1224) 491 | at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1255) 492 | at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:58) 493 | at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:365) 494 | at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409) 495 | at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396) 496 | at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341) 497 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1845) 498 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1782) 499 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:602) 500 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524) 501 | at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) 502 | at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) 503 | at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) 504 | at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) 505 | at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1154) 506 | at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:908) 507 | at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) 508 | at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) 509 | at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) 510 | at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) 511 | at org.springframework.boot.SpringApplication.run(SpringApplication.java:338) 512 | at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) 513 | at org.springframework.boot.SpringApplication.run(SpringApplication.java:1332) 514 | at com.example.springjpabasics1.SpringjpaBasics1Application.main(SpringjpaBasics1Application.java:10) 515 | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 516 | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 517 | at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 518 | at java.base/java.lang.reflect.Method.invoke(Method.java:566) 519 | at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) 520 | Caused by: org.h2.jdbc.JdbcSQLNonTransientException: General error: "java.lang.IllegalStateException: The file is locked: nio:/Users/championswimmer/Development/Scaler/Oct-Nov-Dec-Projects/springjpa-basics-1/test.db.mv.db [1.4.200/7]" [50000-200] 521 | at org.h2.message.DbException.getJdbcSQLException(DbException.java:505) 522 | at org.h2.message.DbException.getJdbcSQLException(DbException.java:429) 523 | ... 73 more 524 | Caused by: java.lang.IllegalStateException: The file is locked: nio:/Users/championswimmer/Development/Scaler/Oct-Nov-Dec-Projects/springjpa-basics-1/test.db.mv.db [1.4.200/7] 525 | at org.h2.mvstore.DataUtils.newIllegalStateException(DataUtils.java:950) 526 | at org.h2.mvstore.FileStore.open(FileStore.java:172) 527 | at org.h2.mvstore.MVStore.(MVStore.java:381) 528 | ... 67 more 529 | --------------------------------------------------------------------------------