Skip to content

Commit a74e5a5

Browse files
make it deployable (#48)
make it deployable in tomcat
1 parent eec2127 commit a74e5a5

File tree

3 files changed

+60
-30
lines changed

3 files changed

+60
-30
lines changed

pom.xml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>com.github.ericsson</groupId>
55
<artifactId>eiffel-intelligence</artifactId>
6-
<version>0.0.1</version>
6+
<version>0.0.2</version>
7+
8+
<packaging>war</packaging>
79

810
<parent>
911
<groupId>org.springframework.boot</groupId>
@@ -47,6 +49,12 @@
4749
<dependency>
4850
<groupId>org.springframework.boot</groupId>
4951
<artifactId>spring-boot-starter-web</artifactId>
52+
<exclusions>
53+
<exclusion>
54+
<groupId>org.springframework.boot</groupId>
55+
<artifactId>spring-boot-starter-tomcat</artifactId>
56+
</exclusion>
57+
</exclusions>
5058
</dependency>
5159

5260
<dependency>
@@ -69,6 +77,12 @@
6977
<artifactId>spring-boot-starter-test</artifactId>
7078
<scope>test</scope>
7179
</dependency>
80+
81+
<dependency>
82+
<groupId>org.springframework.boot</groupId>
83+
<artifactId>spring-boot-starter-tomcat</artifactId>
84+
<scope>provided</scope>
85+
</dependency>
7286

7387
<dependency>
7488
<groupId>com.fasterxml.jackson.core</groupId>
@@ -245,6 +259,14 @@
245259
</includes>
246260
</configuration>
247261
</plugin>
262+
263+
<plugin>
264+
<groupId>org.apache.maven.plugins</groupId>
265+
<artifactId>maven-war-plugin</artifactId>
266+
<configuration>
267+
<failOnMissingWebXml>false</failOnMissingWebXml>
268+
</configuration>
269+
</plugin>
248270

249271
</plugins>
250272
</build>

src/main/java/com/ericsson/ei/App.java

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
import org.springframework.boot.SpringApplication;
2020
import org.springframework.boot.autoconfigure.SpringBootApplication;
21+
import org.springframework.boot.builder.SpringApplicationBuilder;
22+
import org.springframework.boot.web.support.SpringBootServletInitializer;
2123
import org.springframework.scheduling.annotation.EnableAsync;
2224
import org.springframework.scheduling.annotation.EnableScheduling;
2325

@@ -28,24 +30,29 @@
2830
@SpringBootApplication
2931
@EnableAsync
3032
@EnableScheduling
31-
public class App {
32-
33-
public static void main(String[] args) {
34-
35-
List<String> logLevels = new ArrayList<>();
36-
Collections.addAll(logLevels, "ALL", "DEBUG", "ERROR", "FATAL", "INFO", "TRACE", "WARN");
37-
38-
if(args != null && args.length > 0 && logLevels.contains(args[0])) {
39-
System.setProperty("logging.level.root", args[0]);
40-
System.setProperty("logging.level.org.springframework.web", args[0]);
41-
System.setProperty("logging.level.com.ericsson.ei", args[0]);
42-
} else {
43-
System.setProperty("logging.level.root", "OFF");
44-
System.setProperty("logging.level.org.springframework.web", "OFF");
45-
System.setProperty("logging.level.com.ericsson.ei", "OFF");
46-
}
47-
48-
SpringApplication.run(App.class, args);
49-
}
33+
public class App extends SpringBootServletInitializer {
34+
35+
@Override
36+
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
37+
return application.sources(App.class);
38+
}
39+
40+
public static void main(String[] args) {
41+
42+
List<String> logLevels = new ArrayList<>();
43+
Collections.addAll(logLevels, "ALL", "DEBUG", "ERROR", "FATAL", "INFO", "TRACE", "WARN");
44+
45+
if (args != null && args.length > 0 && logLevels.contains(args[0])) {
46+
System.setProperty("logging.level.root", args[0]);
47+
System.setProperty("logging.level.org.springframework.web", args[0]);
48+
System.setProperty("logging.level.com.ericsson.ei", args[0]);
49+
} else {
50+
System.setProperty("logging.level.root", "OFF");
51+
System.setProperty("logging.level.org.springframework.web", "OFF");
52+
System.setProperty("logging.level.com.ericsson.ei", "OFF");
53+
}
54+
55+
SpringApplication.run(App.class, args);
56+
}
5057

5158
}

src/main/java/com/ericsson/ei/waitlist/WaitListWorker.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,19 @@ public void run() {
7272
String event = dbObject.get("Event").toString();
7373
rulesObject = rulesHandler.getRulesForEvent(event);
7474
String idRule = rulesObject.getIdentifyRules();
75-
if (idRule != null && !idRule.isEmpty()) {
76-
JsonNode ids = jmesPathInterface.runRuleOnEvent(idRule, event);
77-
if (ids.isArray()) {
78-
for (final JsonNode idJsonObj : ids) {
79-
ArrayList<String> objects = matchIdRulesHandler.fetchObjectsById(rulesObject, idJsonObj.textValue());
80-
if (objects.size() > 0) {
81-
rmqHandler.publishObjectToWaitlistQueue(event);
82-
waitListStorageHandler.dropDocumentFromWaitList(document);
75+
76+
if (idRule != null && !idRule.isEmpty()) {
77+
JsonNode ids = jmesPathInterface.runRuleOnEvent(idRule, event);
78+
if (ids.isArray()) {
79+
for (final JsonNode idJsonObj : ids) {
80+
ArrayList<String> objects = matchIdRulesHandler.fetchObjectsById(rulesObject, idJsonObj.textValue());
81+
if (objects.size() > 0) {
82+
rmqHandler.publishObjectToWaitlistQueue(event);
83+
waitListStorageHandler.dropDocumentFromWaitList(document);
84+
}
8385
}
8486
}
85-
}
86-
}
87+
}
8788
}
8889
}
8990
}

0 commit comments

Comments
 (0)