Skip to content

Commit

Permalink
Task #78 - StartSrvlogUIApp class implementation started
Browse files Browse the repository at this point in the history
  • Loading branch information
ak committed Jan 22, 2024
1 parent 73195b8 commit 931c5ba
Show file tree
Hide file tree
Showing 5 changed files with 121 additions and 46 deletions.
35 changes: 11 additions & 24 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@
<id>mpos-pne</id>
<url>https://mpos.pne.io/maven2</url>
</repository>

<repository>
<id>pne</id>
<name>payneteasy repo</name>
<url>https://maven.pne.io</url>
</repository>
</repositories>


Expand Down Expand Up @@ -142,35 +148,24 @@
<version>8.0.0-M7</version>
</dependency>

<!-- JETTY DEPENDENCIES FOR TESTING -->
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>${jetty.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId>
<version>${jetty.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-jmx</artifactId>
<version>${jetty.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-plus</artifactId>
<scope>provided</scope>
<version>${jetty.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-jndi</artifactId>
<scope>provided</scope>
<version>${jetty.version}</version>
</dependency>
<dependency>
Expand All @@ -183,11 +178,6 @@
<artifactId>jetty-servlet</artifactId>
<version>11.0.19</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-plus</artifactId>
<version>11.0.19</version>
</dependency>


<!--<dependency>
Expand Down Expand Up @@ -533,17 +523,10 @@
<version>1.0-4</version>
</dependency>

<dependency>
<groupId>com.payneteasy</groupId>
<artifactId>startup-parameters</artifactId>
<version>1.0-6</version>
</dependency>

<dependency>
<groupId>javax.websocket</groupId>
<artifactId>javax.websocket-api</artifactId>
<version>1.1</version>
<scope>provided</scope>
</dependency>

<dependency>
Expand All @@ -562,9 +545,13 @@
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>6.0.0</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.payneteasy</groupId>
<artifactId>startup-parameters</artifactId>
<version>1.0-10</version>
</dependency>

</dependencies>

Expand Down
5 changes: 0 additions & 5 deletions srvlog-it/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,6 @@
</dependency>

<!-- JETTY DEPENDENCIES FOR TESTING -->
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
Expand Down
51 changes: 34 additions & 17 deletions srvlog-web/pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<packaging>war</packaging>
<packaging>jar</packaging>

<artifactId>srvlog-web</artifactId>
<groupId>com.payneteasy.srvlog</groupId>
Expand Down Expand Up @@ -55,31 +55,21 @@
<artifactId>wicket-datetime</artifactId>
</dependency>

<!-- JETTY DEPENDENCIES FOR TESTING -->
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-jmx</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-plus</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-jndi</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
Expand All @@ -93,7 +83,6 @@
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>

<!-- SLF4J -->
Expand Down Expand Up @@ -181,14 +170,12 @@
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<scope>test</scope>
</dependency>

<!-- mysql driver -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>test</scope>
</dependency>

<!--Embedded Tomcat -->
Expand Down Expand Up @@ -230,12 +217,14 @@
<dependency>
<groupId>javax.websocket</groupId>
<artifactId>javax.websocket-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.payneteasy</groupId>
<artifactId>startup-parameters</artifactId>
</dependency>

</dependencies>
Expand All @@ -261,12 +250,40 @@

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<finalName>srvlog-fat</finalName>
<createDependencyReducedPom>false</createDependencyReducedPom>
<artifactSet>
<includes>
<include>*:*</include>
</includes>
</artifactSet>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.payneteasy.srvlog.StartSrvlogUIApp</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
<!--<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.4.0</version>
<configuration>
<attachClasses>true</attachClasses>
</configuration>
</plugin>
</plugin>-->
<!--<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package com.payneteasy.srvlog;

import com.payneteasy.srvlog.config.IStartupConfig;
import com.payneteasy.startup.parameters.StartupParametersFactory;
import org.eclipse.jetty.plus.webapp.EnvConfiguration;
import org.eclipse.jetty.plus.webapp.PlusConfiguration;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.webapp.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;

public class StartSrvlogUIApp {

private static final Logger LOG = LoggerFactory.getLogger(StartSrvlogUIApp.class);

public static void main(String[] args) throws Exception {

try {

IStartupConfig config = StartupParametersFactory.getStartupParameters(IStartupConfig.class);

Server server = new Server(config.getJettyPort());

WebAppContext webAppContext = new WebAppContext();
webAppContext.setContextPath(config.getJettyContext());
webAppContext.setDefaultsDescriptor("src/main/webapp/WEB-INF/web.xml");
webAppContext.setDescriptor(config.webDescriptorPath());
webAppContext.setWar("src/main/webapp");

EnvConfiguration envConfiguration = new EnvConfiguration();
envConfiguration.setJettyEnvXml(new File(config.getJettyEnvConfigPath()).toURI().toURL());

Configuration[] configurations = new Configuration[]{
new WebInfConfiguration(),
new WebXmlConfiguration(),
new MetaInfConfiguration(),
new FragmentConfiguration(),
envConfiguration,
new PlusConfiguration(),
new JettyWebXmlConfiguration()
};

webAppContext.setConfigurations(configurations);
webAppContext.setServer(server);

server.setHandler(webAppContext);

server.start();
server.setStopAtShutdown(true);

} catch (Exception e) {
LOG.error("Cannot start server app", e);
System.exit(1);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.payneteasy.srvlog.config;

import com.payneteasy.startup.parameters.AStartupParameter;

public interface IStartupConfig {

@AStartupParameter(name = "JETTY_CONTEXT", value = "/srvlog")
String getJettyContext();

@AStartupParameter(name = "JETTY_PORT", value = "8080")
int getJettyPort();

@AStartupParameter(name = "JETTY_ENV_CONFIG_PATH", value = "")
String getJettyEnvConfigPath();

@AStartupParameter(name = "WEB_DESCRIPTOR_PATH", value = "")
String webDescriptorPath();
}

0 comments on commit 931c5ba

Please sign in to comment.