You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by ra...@apache.org on 2019/02/03 00:14:01 UTC
[tomee] 02/04: TOMEE-2408 - MP scan configuration all in Installer
just for MP flavour.
This is an automated email from the ASF dual-hosted git repository.
radcortez pushed a commit to branch TOMEE-2408
in repository https://gitbox.apache.org/repos/asf/tomee.git
commit 31b3a71aa198a477518546daaeac7d383dfc7fd8
Author: Roberto Cortez <ra...@yahoo.com>
AuthorDate: Sat Feb 2 22:05:39 2019 +0000
TOMEE-2408 - MP scan configuration all in Installer just for MP flavour.
---
.../src/main/groovy/commands/SetupCommand.groovy | 2 +-
.../java/org/apache/tomee/installer/Installer.java | 24 +++++++++++++++++-----
.../microprofile/TomEEMicroProfileListener.java | 2 +-
3 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/tomee/apache-tomee/src/main/groovy/commands/SetupCommand.groovy b/tomee/apache-tomee/src/main/groovy/commands/SetupCommand.groovy
index 681936f..0ed8fa4 100644
--- a/tomee/apache-tomee/src/main/groovy/commands/SetupCommand.groovy
+++ b/tomee/apache-tomee/src/main/groovy/commands/SetupCommand.groovy
@@ -95,7 +95,7 @@ class SetupCommand {
Paths paths = new Paths(new File("${catalinaHome}/webapps/tomee" as String))
- Installer installer = new Installer(paths, true)
+ Installer installer = new Installer(paths, properties, true)
installer.installFull()
// clean up duplicate jars since in TomEE it is useless
diff --git a/tomee/tomee-common/src/main/java/org/apache/tomee/installer/Installer.java b/tomee/tomee-common/src/main/java/org/apache/tomee/installer/Installer.java
index ed06036..17eb85f 100644
--- a/tomee/tomee-common/src/main/java/org/apache/tomee/installer/Installer.java
+++ b/tomee/tomee-common/src/main/java/org/apache/tomee/installer/Installer.java
@@ -1,5 +1,4 @@
-/**
- *
+/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -23,6 +22,10 @@ import org.apache.openejb.loader.SystemInstance;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.function.BiFunction;
+import java.util.function.Consumer;
import java.util.jar.JarFile;
public class Installer implements InstallerInterface {
@@ -31,6 +34,7 @@ public class Installer implements InstallerInterface {
private final Paths paths;
private Status status = Status.NONE;
private boolean force;
+ private Map<String, String> properties;
private static final boolean LISTENER_INSTALLED;
private static final boolean AGENT_INSTALLED;
@@ -59,6 +63,8 @@ public class Installer implements InstallerInterface {
if (LISTENER_INSTALLED && AGENT_INSTALLED) {
status = Status.INSTALLED;
}
+
+ this.properties = new HashMap<>();
}
public Installer(final Paths paths, final boolean force) {
@@ -66,6 +72,11 @@ public class Installer implements InstallerInterface {
this.force = force;
}
+ public Installer(final Paths paths, final Map<String, String> properties, final boolean force) {
+ this(paths, force);
+ this.properties = properties;
+ }
+
@Override
public PathsInterface getPaths() {
return paths;
@@ -791,9 +802,12 @@ public class Installer implements InstallerInterface {
systemPropertiesWriter.write("# javax.xml.soap.SOAPConnectionFactory = com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnectionFactory\n");
systemPropertiesWriter.write("# javax.xml.soap.MetaFactory = com.sun.xml.messaging.saaj.soap.SAAJMetaFactoryImpl\n");
- systemPropertiesWriter.write("#\n");
- systemPropertiesWriter.write("# MicroProfile\n");
- systemPropertiesWriter.write("tomee.mp.scan = none\n");
+ final String flavour = properties.getOrDefault("tomee.webapp", "");
+ if (flavour.contains("microprofile")) {
+ systemPropertiesWriter.write("#\n");
+ systemPropertiesWriter.write("# MicroProfile\n");
+ systemPropertiesWriter.write("tomee.mp.scan = all\n");
+ }
} catch (final IOException e) {
// ignored, this file is far to be mandatory
diff --git a/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/TomEEMicroProfileListener.java b/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/TomEEMicroProfileListener.java
index 17867fc..c44989a 100644
--- a/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/TomEEMicroProfileListener.java
+++ b/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/TomEEMicroProfileListener.java
@@ -64,7 +64,7 @@ public class TomEEMicroProfileListener {
@SuppressWarnings("Duplicates")
public void enrichContainerWithMicroProfile(@Observes final AfterContainerUrlScanEvent afterContainerUrlScanEvent) {
- final String mpScan = SystemInstance.get().getOptions().get("tomee.mp.scan", "all");
+ final String mpScan = SystemInstance.get().getOptions().get("tomee.mp.scan", "none");
if (mpScan.equals("none")) {
Stream.of(MICROPROFILE_EXTENSIONS).forEach(