Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update pom, introduce logging framework, update gitignore #46

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
43 changes: 42 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,45 @@
# Ignoring root .vscode folder.
.vscode/
# Ignoring ~/build inside LMSourceCode
/Software/LMSourceCode/ImageProcessing/build
/Software/LMSourceCode/ImageProcessing/build

HELP.md
out/
**/target/
!.mvn/wrapper/maven-wrapper.jar
*.war
!**/src/main/**/target/
!**/src/test/**/target/
.DS_Store
**/.DS_Store
# Package Files #
/Software/ImageProcessing/golfsim_tomee_webapp/target
/Software/ImageProcessing/golfsim_tomee_webapp/.codesight
**/LMSourceCode/ImageProcessing/golfsim_tomee_webapp/target
**/.war

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### IntelliJ IDEA ###
**/.idea
.idea
*.iws
*.iml
*.ipr

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
119 changes: 89 additions & 30 deletions Software/LMSourceCode/ImageProcessing/golfsim_tomee_webapp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,59 +16,119 @@
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<failOnMissingWebXml>false</failOnMissingWebXml>

<!-- tommee -->
<tommee-maven-plugin.version>8.0.9</tommee-maven-plugin.version>
<tommee.version>10.0.0</tommee.version>

<!-- maven -->
<maven-clean-plugin.version>3.1.0</maven-clean-plugin.version>
<maven-resources-plugin.version>3.0.2</maven-resources-plugin.version>
<maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
<maven-sunfire-plugin.version>3.0.0-M7</maven-sunfire-plugin.version>
<maven-jar-plugin.version>3.0.2</maven-jar-plugin.version>
<maven-war-plugin.version>3.3.2</maven-war-plugin.version>
<maven-install-plugin.version>2.5.2</maven-install-plugin.version>
<maven-deploy-plugin.version>2.8.2</maven-deploy-plugin.version>
<maven-site-plugin.version>3.7.1</maven-site-plugin.version>
<maven-project-info-reports-plugin.version>3.0.0</maven-project-info-reports-plugin.version>

<!-- jakarta -->
<jakartaee-web-api.version>9.0.0</jakartaee-web-api.version>
<jakarta-servlet-api.version>6.1.0-M1</jakarta-servlet-api.version>

<!-- Apache ActiveMQ -->
<activemq-client.version>6.0.1</activemq-client.version>
<!-- activemq-camel, vulnerability found, upgrade on future PR -->
<activemq-camel.version>5.16.7</activemq-camel.version>
<activemq-pool.version>6.0.1</activemq-pool.version>
<activemq-broker.version>6.0.1</activemq-broker.version>

<!-- misc -->
<msgpack-core.version>0.9.6</msgpack-core.version>
<gson.version>2.9.0</gson.version>

<!-- logging -->
<log4j.version>2.24.3</log4j.version>

<!-- test -->
<junit-jupiter-api.version>5.11.4</junit-jupiter-api.version>
<mockito-junit-jupiter.version>5.15.2</mockito-junit-jupiter.version>
</properties>

<dependencies>
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-web-api</artifactId>
<version>9.0.0</version>
<version>${jakartaee-web-api.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>6.1.0-M1</version>
<version>${jakarta-servlet-api.version}</version>
<scope>provided</scope>
</dependency>

<!-- the ActiveMQ client with connection pooling -->
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-client</artifactId>
<version>6.0.1</version>
<version>${activemq-client.version}</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-camel</artifactId>
<version>5.16.7</version>
<version>${activemq-camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-pool</artifactId>
<version>6.0.1</version>
<version>${activemq-pool.version}</version>
</dependency>
<!-- the ActiveMQ broker is optional and can be removed if connecting to a remote broker on
ly -->
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-broker</artifactId>
<version>6.0.1</version>
<version>${activemq-broker.version}</version>
</dependency>

<dependency>
<groupId>org.msgpack</groupId>
<artifactId>msgpack-core</artifactId>
<version>${msgpack-core.version}</version>
</dependency>

<dependency>
<groupId>org.msgpack</groupId>
<artifactId>msgpack-core</artifactId>
<version>0.9.6</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${gson.version}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit-jupiter-api.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>${mockito-junit-jupiter.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.9.0</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j.version}</version>
</dependency>



</dependencies>

Expand All @@ -79,57 +139,56 @@ ly -->
<plugin>
<groupId>org.apache.tomee.maven</groupId>
<artifactId>tomee-maven-plugin</artifactId>
<version>8.0.9</version>
<version>${tommee-maven-plugin.version}</version>
<configuration>
<tomeeVersion>10.0.0</tomeeVersion>
<tomeeVersion>${tommee.version}</tomeeVersion>
<tomeeClassifier>plus</tomeeClassifier>
</configuration>
</plugin>
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
<version>${maven-clean-plugin.version}</version>
</plugin>
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<version>${maven-resources-plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<version>${maven-compiler-plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
<version>${maven-sunfire-plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<version>${maven-jar-plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.3.2</version>
<version>${maven-war-plugin.version}</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
<version>${maven-install-plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<version>${maven-deploy-plugin.version}</version>
</plugin>
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
<version>${maven-site-plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
<version>${maven-project-info-reports-plugin.version}</version>
</plugin>
</plugins>
</pluginManagement>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,37 +1,22 @@
package com.verdanttechs.jakarta.ee9;

import java.util.Vector;
import java.lang.Math;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.msgpack.core.MessagePack;
import org.msgpack.core.MessagePack.PackerConfig;
import org.msgpack.core.MessagePack.UnpackerConfig;
import org.msgpack.core.MessageBufferPacker;
import org.msgpack.core.MessageFormat;
import org.msgpack.core.MessagePacker;
import org.msgpack.core.MessageUnpacker;
import org.msgpack.value.ArrayValue;
import org.msgpack.value.ExtensionValue;
import org.msgpack.value.FloatValue;
import org.msgpack.value.IntegerValue;
import org.msgpack.value.TimestampValue;
import org.msgpack.value.Value;
import org.msgpack.core.annotations.Nullable;
import org.msgpack.core.annotations.VisibleForTesting;


import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpSession;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.ServletContextListener;
import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletContextEvent;
import jakarta.servlet.ServletContextListener;
import jakarta.servlet.annotation.WebListener;

import jakarta.jms.Connection;
import jakarta.jms.Session;
Expand All @@ -42,9 +27,6 @@
import jakarta.jms.DeliveryMode;
import jakarta.jms.TextMessage;
import jakarta.jms.BytesMessage;
import jakarta.jms.Topic;
import jakarta.jms.Queue;
import jakarta.jms.ConnectionFactory;
import jakarta.jms.JMSException;
import jakarta.jms.ExceptionListener;

Expand All @@ -62,7 +44,7 @@
@WebServlet("/monitor")
public class MonitorServlet extends HttpServlet {

// NOTE - these should reflect types in gs_ipc_result
private static Logger logger = LogManager.getLogger(MonitorServlet.class);
public enum GsIPCResultType {
kUnknown,
kInitializing,
Expand Down Expand Up @@ -109,8 +91,9 @@ public static class GsControlMessage {
public static Session producer_session;
public static Destination producer_destination;

public static void SetCurrentClubType(GsClubType club) {
System.out.println("SetClubType called with club type = " + String.valueOf(club));
public static void SetCurrentClubType(GsClubType club) {
logger.info("SetClubType called with club type = " + String.valueOf(club));
System.out.println("SetClubType called with club type = " + String.valueOf(club));

try {
if (!producer_created) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
Configuration:
status: warn

appenders:
Console:
name: LogToConsole
PatternLayout:
Pattern: "[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n"

#File:
# name: File
# fileName: logs/app.log
# PatternLayout:
# Pattern: "%d %p %C{1.} [%t] %m%n"

RollingFile:
- name: LogToRollingFile
fileName: logs/app.log
filePattern: "logs/$${date:yyyy-MM}/app-%d{MM-dd-yyyy}-%i.log.gz"
PatternLayout:
pattern: "[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n"
Policies:
SizeBasedTriggeringPolicy:
size: 10MB
DefaultRollOverStrategy:
max: 10

Loggers:
logger:
- name: com.mkyong
level: debug
additivity: false
AppenderRef:
- ref: LogToConsole
- ref: LogToRollingFile

Root:
level: error
AppenderRef:
ref: LogToConsole
Loading
Loading