Skip to content

Commit

Permalink
updated API's to use the latest packages
Browse files Browse the repository at this point in the history
  • Loading branch information
mrin9 committed Jan 25, 2021
1 parent 73ada09 commit 3f11e4b
Show file tree
Hide file tree
Showing 92 changed files with 1,380 additions and 1,245 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ PROJECT_FOLDER
```

### Build Process
- 1st Build Frontend (optional, requiered only if you make changes to fronend code )
- Then Build Backend (backend build script will copy UI code build above into itsself)
- 1st Build Frontend (optional, required only if you make changes to frontend code )
- Then Build Backend (backend build script will copy UI code build above into itself)

#### To build frontend (optional step)
```bash
Expand Down
129 changes: 62 additions & 67 deletions database/pom.xml
Original file line number Diff line number Diff line change
@@ -1,75 +1,70 @@
<project xmlns="https://maven.apache.org/POM/4.0.0" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.mrin</groupId>
<artifactId>jersey-vue</artifactId>
<version>1.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.mrin</groupId>
<artifactId>database</artifactId>
<packaging>jar</packaging>
<artifactId>jersey-vue</artifactId>
<version>1.0.0</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<h2-version>1.4.197</h2-version>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/com.h2database/h2 -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>${h2-version}</version>
</dependency>
</parent>
<groupId>com.mrin</groupId>
<artifactId>database</artifactId>
<packaging>jar</packaging>
<version>1.0.0</version>
<dependencies>
<!-- https://mvnrepository.com/artifact/com.h2database/h2 -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>${h2-database-version}</version>
</dependency>
</dependencies>

</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
</archive>
<outputDirectory>
${project.build.directory}/modules
</outputDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>
${project.build.directory}/modules
</outputDirectory>
<includeScope>runtime</includeScope>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
</archive>
<outputDirectory>
${project.build.directory}/modules
</outputDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>
${project.build.directory}/modules
</outputDirectory>
<includeScope>runtime</includeScope>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>

</plugins>
</build>
</plugins>
</build>

</project>
16 changes: 4 additions & 12 deletions database/src/main/java/com/app/DatabaseService.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
import org.slf4j.*;

public class DatabaseService {
private static Logger log = LoggerFactory.getLogger(DatabaseService.class);
//private static final java.util.logging.Logger log = java.util.logging.Logger.getLogger(DatabaseService.class.getName());
private static final Logger log = LoggerFactory.getLogger(DatabaseService.class);

private static final String DB_DRIVER = "org.h2.Driver";
private static final String DB_CONNECTION = "jdbc:h2:mem:test;INIT=RUNSCRIPT FROM 'classpath:schema.sql'\\;runscript from 'classpath:data.sql'";
Expand All @@ -17,13 +16,11 @@ public class DatabaseService {
private static Server dbWebServer = null;

public static void initDB() {

try {
getDBConnection();
//dbWebServer = Server.createWebServer("-webPort","9000", "-webAllowOthers").start();
dbWebServer = Server.createTcpServer("-tcpPort", "9092", "-tcpAllowOthers").start();
}
catch (SQLException e) {
} catch (SQLException e) {
e.printStackTrace();
}
log.info("\n\n *** Database Initiated ***"+
Expand All @@ -33,23 +30,20 @@ public static void initDB() {
"\n Password : "+DB_PASSWORD +
"\n *** *** *** *** *** \n"
);

}

private static Connection getDBConnection() {
Connection dbConnection = null;
try {
Class.forName(DB_DRIVER);
}
catch (ClassNotFoundException e) {
} catch (ClassNotFoundException e) {
log.error(e.getMessage());
}

try {
dbConnection = DriverManager.getConnection(DB_CONNECTION, DB_USER, DB_PASSWORD);
return dbConnection;
}
catch (SQLException e) {
} catch (SQLException e) {
log.error(e.getMessage());
}

Expand All @@ -65,6 +59,4 @@ public static InputStream getSqlScriptResourceAsStream(String fileName){
InputStream is = DatabaseService.class.getClassLoader().getResourceAsStream(fileName);
return is;
}


}
2 changes: 1 addition & 1 deletion database/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module com.app {
requires org.slf4j;
requires java.sql;
requires h2;
requires com.h2database;
exports com.app;
}
171 changes: 85 additions & 86 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,95 +1,94 @@
<project xmlns="https://maven.apache.org/POM/4.0.0" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mrin</groupId>
<artifactId>jersey-vue</artifactId>
<version>1.0.0</version>
<packaging>pom</packaging>
<modelVersion>4.0.0</modelVersion>
<groupId>com.mrin</groupId>
<artifactId>jersey-vue</artifactId>
<version>1.0.0</version>
<packaging>pom</packaging>

<repositories>
<repository>
<id>projectlombok.org</id>
<url>https://projectlombok.org/edge-releases</url>
</repository>
</repositories>
<!-- Build order of these modules is evaluated based of dependency graph -->
<modules>
<!-- module>web-ui</module --> <!-- Build web-ui first so that the static files can be copied into the final jar -->
<module>database</module>
<module>web-api</module> <!-- to exclude web-ui during build >>> mvn -pl '!web-ui' install -->
</modules>

<!-- Build order of these modules is evaluated based of dependency graph -->
<modules>
<!-- module>web-ui</module --> <!-- Build web-ui first so that the static files can be copied into the final jar -->
<module>database</module>
<module>web-api</module> <!-- to exclude web-ui during build >>> mvn -pl '!web-ui' install -->
</modules>

<!-- Common Properties for all modules -->
<properties>
<log4j-version>2.11.1</log4j-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<!-- Common Properties for all modules -->
<properties>
<log4j-version>2.14.0</log4j-version>
<tomcat-version>9.0.41</tomcat-version>
<jersey-version>2.33</jersey-version>
<swagger-version>1.5.21</swagger-version>
<jackson-version>2.12.1</jackson-version>
<hibernate-version>4.3.11.Final</hibernate-version> <!-- Hibernate 5 (5.3.6.Final) and above gives a classCastException -->
<maven-jar-plugin-version>3.1.0</maven-jar-plugin-version>
<maven-dependency-plugin-version>3.1.1</maven-dependency-plugin-version>
<commons-lang-version>3.11</commons-lang-version>
<commons-text-version>1.9</commons-text-version>
<h2-database-version>1.4.200</h2-database-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<!-- Check dependency updates using:
mvn versions:display-dependency-updates
-->

<!-- Jars added in Parent POM will auto included in children -->
<dependencies>
<!-- Log4J -->
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-slf4j18-impl -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j18-impl</artifactId>
<version>${log4j-version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.0-alpha1</version>
</dependency>

<!-- Jars added in Parent POM will auto included in children -->
<dependencies>
<!-- Log4J -->
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-slf4j18-impl -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j18-impl</artifactId>
<version>${log4j-version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.8.0-beta2</version>
</dependency>
<!-- commons-text -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>${commons-text-version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons-lang-version}</version>
</dependency>
</dependencies>

<!-- commons-text -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>1.6</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.8.1</version>
</dependency>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<!-- Source & target are not necessary, but intelliJ depends on it to set the Java compiler settings -->
<source>11</source>
<target>11</target>
<release>11</release>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>


</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<!-- Source & target are not necessary, but intelliJ depends on it to set the Java compiler settings -->
<source>11</source>
<target>11</target>
<release>11</release>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>

<!-- mvn versions:display-dependency-updates -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.7</version>
</plugin>
</plugins>
</build>




<!-- mvn versions:display-dependency-updates -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.7</version>
</plugin>
</plugins>
</build>
</project>
Loading

0 comments on commit 3f11e4b

Please sign in to comment.