You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rm...@apache.org on 2018/03/12 15:00:47 UTC

[29/32] tomee git commit: Introduced configuration properties to include / exclude urls in the Classloader.

Introduced configuration properties to include / exclude urls in the Classloader.


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/021b9ca8
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/021b9ca8
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/021b9ca8

Branch: refs/heads/fb_tomee8
Commit: 021b9ca8d01a78f5b7ee3438f30fd8901ff60d5b
Parents: a04e4b7
Author: Roberto Cortez <ra...@yahoo.com>
Authored: Fri Mar 9 16:10:56 2018 +0000
Committer: Roberto Cortez <ra...@yahoo.com>
Committed: Fri Mar 9 16:10:56 2018 +0000

----------------------------------------------------------------------
 .../apache/openejb/config/DeploymentLoader.java | 12 +++--
 .../config/src/test/resources/arquillian.xml    |  2 +
 tomee/pom.xml                                   |  1 -
 tomee/tomee-microprofile-webapp/pom.xml         |  6 ---
 tomee/tomee-microprofile/pom.xml                | 56 --------------------
 .../tomee/microprofile/MicroProfileService.java | 51 ------------------
 6 files changed, 11 insertions(+), 117 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/021b9ca8/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java b/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
index 1135c07..d602f81 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
@@ -60,6 +60,7 @@ import org.apache.xbean.finder.UrlSet;
 import org.apache.xbean.finder.archive.ClassesArchive;
 import org.apache.xbean.finder.filter.Filter;
 import org.apache.xbean.finder.filter.Filters;
+import org.apache.xbean.finder.filter.PatternFilter;
 
 import java.io.BufferedInputStream;
 import java.io.File;
@@ -81,6 +82,7 @@ import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Properties;
 import java.util.Set;
@@ -90,7 +92,6 @@ import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
 import java.util.jar.Manifest;
 import java.util.zip.ZipEntry;
-import java.util.Locale;
 
 import static java.util.Arrays.asList;
 
@@ -116,6 +117,9 @@ public class DeploymentLoader implements DeploymentFilterable {
     private static String ALTDD = SystemInstance.get().getOptions().get(OPENEJB_ALTDD_PREFIX, (String) null);
     private volatile List<URL> containerUrls = null;
 
+    private static final String OPENEJB_CONTAINER_INCLUDES = "openejb.scan.webapp.container.includes";
+    private static final String OPENEJB_CONTAINER_EXCLUDES = "openejb.scan.webapp.container.excludes";
+
     @Deprecated // use load(File, ExternalConfiguration)
     public AppModule load(final File jarFile) throws OpenEJBException {
         return load(jarFile, null);
@@ -1098,13 +1102,15 @@ public class DeploymentLoader implements DeploymentFilterable {
 
     private void ensureContainerUrls() {
         if (containerUrls == null) {
-            if ("true".equalsIgnoreCase(SystemInstance.get().getProperty("openejb.scan.webapp.container", "false"))) {
+            if ("true".equalsIgnoreCase(SystemInstance.get().getProperty("openejb.scan.webapp.container", "true"))) {
                 synchronized (this) {
                     if (containerUrls == null) {
                         try {
                             UrlSet urlSet = new UrlSet(ParentClassLoaderFinder.Helper.get());
                             urlSet = URLs.cullSystemJars(urlSet);
-                            urlSet = NewLoaderLogic.applyBuiltinExcludes(urlSet);
+                            final PatternFilter containerIncludes = new PatternFilter(SystemInstance.get().getProperty(OPENEJB_CONTAINER_INCLUDES, ".*"));
+                            final PatternFilter containerExcludes = new PatternFilter(SystemInstance.get().getProperty(OPENEJB_CONTAINER_EXCLUDES, ""));
+                            urlSet = NewLoaderLogic.applyBuiltinExcludes(urlSet, containerIncludes, containerExcludes);
                             containerUrls = urlSet.getUrls();
 
                             final boolean skipContainerFolders = "true".equalsIgnoreCase(SystemInstance.get().getProperty("openejb.scan.webapp.container.skip-folder", "true"));

http://git-wip-us.apache.org/repos/asf/tomee/blob/021b9ca8/tck/microprofile-tck/config/src/test/resources/arquillian.xml
----------------------------------------------------------------------
diff --git a/tck/microprofile-tck/config/src/test/resources/arquillian.xml b/tck/microprofile-tck/config/src/test/resources/arquillian.xml
index 629d71d..d04c730 100644
--- a/tck/microprofile-tck/config/src/test/resources/arquillian.xml
+++ b/tck/microprofile-tck/config/src/test/resources/arquillian.xml
@@ -23,6 +23,7 @@
               http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
   <container qualifier="tomee-remote" default="true">
     <configuration>
+      <property name="debug">false</property>
       <property name="httpPort">-1</property>
       <property name="ajpPort">-1</property>
       <property name="stopPort">-1</property>
@@ -33,6 +34,7 @@
       <property name="cleanOnStartUp">true</property>
       <property name="properties">
         config.test = SUCCESS
+        org.apache.geronimo.config.configsource.SystemPropertyConfigSource.copy = false
       </property>
     </configuration>
   </container>

http://git-wip-us.apache.org/repos/asf/tomee/blob/021b9ca8/tomee/pom.xml
----------------------------------------------------------------------
diff --git a/tomee/pom.xml b/tomee/pom.xml
index 0ac220a..c92e163 100644
--- a/tomee/pom.xml
+++ b/tomee/pom.xml
@@ -47,7 +47,6 @@
     <module>tomee-plume-webapp</module>
     <module>tomee-webservices</module>
     <module>tomee-embedded</module>
-    <module>tomee-microprofile</module>
     <module>tomee-microprofile-webapp</module>
     <module>apache-tomee</module>
     <module>tomee-util</module>

http://git-wip-us.apache.org/repos/asf/tomee/blob/021b9ca8/tomee/tomee-microprofile-webapp/pom.xml
----------------------------------------------------------------------
diff --git a/tomee/tomee-microprofile-webapp/pom.xml b/tomee/tomee-microprofile-webapp/pom.xml
index 55ae7f0..4d0b71f 100644
--- a/tomee/tomee-microprofile-webapp/pom.xml
+++ b/tomee/tomee-microprofile-webapp/pom.xml
@@ -52,12 +52,6 @@
       <type>war</type>
     </dependency>
 
-    <dependency>
-      <groupId>${project.groupId}</groupId>
-      <artifactId>tomee-microprofile</artifactId>
-      <version>${project.version}</version>
-    </dependency>
-
     <!-- When we have everything
     <dependency>
       <groupId>org.eclipse.microprofile</groupId>

http://git-wip-us.apache.org/repos/asf/tomee/blob/021b9ca8/tomee/tomee-microprofile/pom.xml
----------------------------------------------------------------------
diff --git a/tomee/tomee-microprofile/pom.xml b/tomee/tomee-microprofile/pom.xml
deleted file mode 100644
index 97f99f1..0000000
--- a/tomee/tomee-microprofile/pom.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
-    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.
-    The ASF licenses this file to You under the Apache License, Version 2.0
-    (the "License"); you may not use this file except in compliance with
-    the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
--->
-
-<!-- $Rev: 600338 $ $Date: 2007-12-02 09:08:04 -0800 (Sun, 02 Dec 2007) $ -->
-
-<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">
-
-  <parent>
-    <artifactId>tomee</artifactId>
-    <groupId>org.apache.tomee</groupId>
-    <version>7.0.5-SNAPSHOT</version>
-  </parent>
-
-  <modelVersion>4.0.0</modelVersion>
-  <artifactId>tomee-microprofile</artifactId>
-  <packaging>jar</packaging>
-  <name>OpenEJB :: TomEE :: MicroProfile</name>
-
-  <properties>
-    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-  </properties>
-
-  <dependencies>
-    <dependency>
-      <groupId>${project.groupId}</groupId>
-      <artifactId>tomee-catalina</artifactId>
-      <version>${project.version}</version>
-      <scope>provided</scope>
-    </dependency>
-
-    <dependency>
-      <groupId>${project.groupId}</groupId>
-      <artifactId>tomee-common</artifactId>
-      <version>${project.version}</version>
-      <scope>provided</scope>
-    </dependency>
-  </dependencies>
-
-</project>

http://git-wip-us.apache.org/repos/asf/tomee/blob/021b9ca8/tomee/tomee-microprofile/src/main/java/org/apache/tomee/microprofile/MicroProfileService.java
----------------------------------------------------------------------
diff --git a/tomee/tomee-microprofile/src/main/java/org/apache/tomee/microprofile/MicroProfileService.java b/tomee/tomee-microprofile/src/main/java/org/apache/tomee/microprofile/MicroProfileService.java
deleted file mode 100644
index 70448c6..0000000
--- a/tomee/tomee-microprofile/src/main/java/org/apache/tomee/microprofile/MicroProfileService.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tomee.microprofile;
-
-import org.apache.openejb.loader.SystemInstance;
-import org.apache.openejb.spi.Service;
-
-import java.util.Properties;
-
-import static org.apache.tomee.catalina.TomEEClassLoaderEnricher.TOMEE_WEBAPP_CLASSLOADER_ENRICHMENT_PREFIXES;
-
-/**
- * This is used as an optional service in org.apache.tomee.catalina.TomcatLoader
- */
-@SuppressWarnings("unused")
-public class MicroProfileService implements Service {
-    // Separate with comma
-    private static final String MICROPROFILE_LIBS_IMPLS_PREFIXES = "geronimo-config-impl";
-
-    @Override
-    public void init(final Properties props) throws Exception {
-        String prefixes = SystemInstance.get().getOptions().get(TOMEE_WEBAPP_CLASSLOADER_ENRICHMENT_PREFIXES, "");
-        prefixes = prefixes.isEmpty() ?
-                   MICROPROFILE_LIBS_IMPLS_PREFIXES :
-                   MICROPROFILE_LIBS_IMPLS_PREFIXES + "," + prefixes;
-
-        SystemInstance.get()
-                      .getOptions()
-                      .getProperties()
-                      .setProperty(TOMEE_WEBAPP_CLASSLOADER_ENRICHMENT_PREFIXES, prefixes);
-
-        final String microProfileReloadConfig =
-                System.getProperty("org.apache.geronimo.config.configsource.SystemPropertyConfigSource.copy", "false");
-        System.setProperty("org.apache.geronimo.config.configsource.SystemPropertyConfigSource.copy",
-                           microProfileReloadConfig);
-    }
-}