openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1766249 - in /openwebbeans/microwave/trunk/microwave-core/src/main: java/org/apache/microwave/openwebbeans/ resources/META-INF/openwebbeans/
Date Sun, 23 Oct 2016 08:35:58 GMT
Author: rmannibucau
Date: Sun Oct 23 08:35:58 2016
New Revision: 1766249

URL: http://svn.apache.org/viewvc?rev=1766249&view=rev
Log:
custom tomcat/owb filtering

Added:
    openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/openwebbeans/KnownJarsFilter.java
    openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/openwebbeans/OWBTomcatWebScannerService.java
Modified:
    openwebbeans/microwave/trunk/microwave-core/src/main/resources/META-INF/openwebbeans/openwebbeans.properties

Added: openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/openwebbeans/KnownJarsFilter.java
URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/openwebbeans/KnownJarsFilter.java?rev=1766249&view=auto
==============================================================================
--- openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/openwebbeans/KnownJarsFilter.java
(added)
+++ openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/openwebbeans/KnownJarsFilter.java
Sun Oct 23 08:35:58 2016
@@ -0,0 +1,291 @@
+/*
+ * 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.microwave.openwebbeans;
+
+import org.apache.tomcat.JarScanFilter;
+import org.apache.tomcat.JarScanType;
+
+import java.util.Collection;
+import java.util.HashSet;
+
+public class KnownJarsFilter implements JarScanFilter {
+    private final Collection<String> forceIncludes = new HashSet<String>() {{
+        add("cxf-integration-cdi");
+    }};
+
+    private final Collection<String> excludes = new HashSet<String>() {{
+        add("tools.jar");
+        add("bootstrap.jar");
+        add("ApacheJMeter");
+        add("XmlSchema-");
+        add("activation-");
+        add("activeio-");
+        add("activemq-");
+        add("aether-");
+        add("akka-actor-");
+        add("akka-cluster-");
+        add("akka-remote-");
+        add("antlr-");
+        add("aopalliance-");
+        add("arquillian-core.jar");
+        add("arquillian-testng.jar");
+        add("arquillian-junit.jar");
+        add("arquillian-transaction.jar");
+        add("arquillian-common");
+        add("arquillian-config-");
+        add("arquillian-core-api-");
+        add("arquillian-core-impl-base");
+        add("arquillian-core-spi-");
+        add("arquillian-container-");
+        add("arquillian-junit-");
+        add("arquillian-test-api");
+        add("arquillian-test-impl-base");
+        add("arquillian-test-spi");
+        add("arquillian-tomee-");
+        add("asm-");
+        add("avalon-framework-");
+        add("axis-");
+        add("axis2-");
+        add("batchee-jbatch");
+        add("bcprov-");
+        add("bootstrap.jar");
+        add("bval-core");
+        add("bval-jsr");
+        add("c3p0-");
+        add("cassandra-driver-core");
+        add("catalina-");
+        add("catalina.jar");
+        add("cglib-");
+        add("charsets.jar");
+        add("commons-beanutils");
+        add("commons-cli-");
+        add("commons-codec-");
+        add("commons-collections-");
+        add("commons-dbcp");
+        add("commons-dbcp-all-1.3-");
+        add("commons-digester-");
+        add("commons-discovery-");
+        add("commons-httpclient-");
+        add("commons-io-");
+        add("commons-jcs-core-");
+        add("commons-lang-");
+        add("commons-lang3-");
+        add("commons-logging-");
+        add("commons-logging-api-");
+        add("commons-net-");
+        add("commons-pool-");
+        add("commons-pool2-");
+        add("cryptacular-");
+        add("cssparser-");
+        add("cxf-");
+        add("deploy.jar");
+        add("derby-");
+        add("derbyclient-");
+        add("derbynet-");
+        add("dom4j");
+        add("ecj-");
+        add("el-api");
+        add("eclipselink-");
+        add("ehcache-");
+        add("FastInfoset");
+        add("jce.jar");
+        add("jfr.jar");
+        add("jfxrt.jar");
+        add("jnr-");
+        add("johnzon-");
+        add("fusemq-leveldb-");
+        add("geronimo-");
+        add("google-");
+        add("gragent.jar");
+        add("groovy-");
+        add("gson-");
+        add("guava-");
+        add("guice-");
+        add("hamcrest-");
+        add("hawtbuf-");
+        add("hawtdispatch-");
+        add("hawtjni-runtime");
+        add("hibernate-");
+        add("howl-");
+        add("hsqldb-");
+        add("htmlunit-");
+        add("httpclient-");
+        add("httpcore-");
+        add("icu4j-");
+        add("idb-");
+        add("idea_rt.jar");
+        add("istack-commons-runtime-");
+        add("jackson-annotations-");
+        add("jackson-core-");
+        add("jackson-databind-");
+        add("jackson-mapper-asl-");
+        add("jackson-module-jaxb-annotations-");
+        add("janino-");
+        add("jansi-");
+        add("jasper.jar");
+        add("jasper-el.jar");
+        add("jasypt-");
+        add("java-atk-wrapper");
+        add("java-support-");
+        add("javaee-");
+        add("javaee-api");
+        add("javassist-");
+        add("javaws.jar");
+        add("javax.");
+        add("jaxb-");
+        add("jaxp-");
+        add("jboss-");
+        add("jbossall-");
+        add("jbosscx-");
+        add("jbossjts-");
+        add("jbosssx-");
+        add("jcommander-");
+        add("jersey-");
+        add("jettison-");
+        add("jetty-");
+        add("jline");
+        add("jmdns-");
+        add("joda-time-");
+        add("johnzon-");
+        add("jsoup-");
+        add("jsp-api");
+        add("jsr299-");
+        add("jsr311-");
+        add("jsse.jar");
+        add("juli-");
+        add("junit-");
+        add("kahadb-");
+        add("kotlin-runtime");
+        add("leveldb");
+        add("log4j-");
+        add("logkit-");
+        add("lucene-analyzers-");
+        add("lucene-core-");
+        add("management-agent.jar");
+        add("maven-");
+        add("mbean-annotation-api-");
+        add("microwave-maven-");
+        add("microwave-gradle-");
+        add("mimepull-");
+        add("mina-");
+        add("mqtt-client-");
+        add("myfaces-api");
+        add("myfaces-impl");
+        add("mysql-connector-java-");
+        add("neethi-");
+        add("nekohtml-");
+        add("netty-");
+        add("openjpa-");
+        add("openmdx-");
+        add("opensaml-");
+        add("openwebbeans-");
+        add("openws-");
+        add("ops4j-");
+        add("org.eclipse.");
+        add("org.junit.");
+        add("org.osgi.core-");
+        add("oro-");
+        add("pax-url");
+        add("PDFBox");
+        add("plexus-");
+        add("plugin.jar");
+        add("poi-");
+        add("quartz-2");
+        add("quartz-openejb-");
+        add("resources.jar");
+        add("rmock-");
+        add("rt.jar");
+        add("saaj-");
+        add("sac-");
+        add("scala-library-");
+        add("scalatest");
+        add("scannotation-");
+        add("serializer-");
+        add("serp-");
+        add("servlet-api-");
+        add("sisu-inject");
+        add("sisu-guice");
+        add("shrinkwrap-");
+        add("slf4j-");
+        add("smack-");
+        add("smackx-");
+        add("snappy-java-");
+        add("spring-");
+        add("sshd-");
+        add("stax-api-");
+        add("stax2-api-");
+        add("sunec.jar");
+        add("surefire-");
+        add("swizzle-");
+        add("sxc-");
+        add("testng-");
+        add("tomcat-annotations");
+        add("tomcat-api");
+        add("tomcat-catalina");
+        add("tomcat-coyote");
+        add("tomcat-dbcp");
+        add("tomcat-el");
+        add("tomcat-i18n");
+        add("tomcat-jasper");
+        add("tomcat-jaspic");
+        add("tomcat-jdbc");
+        add("tomcat-jni");
+        add("tomcat-jsp");
+        add("tomcat-juli");
+        add("tomcat-tribes");
+        add("tomcat-servlet");
+        add("tomcat-spdy");
+        add("tomcat-util");
+        add("tomcat-websocket-api");
+        add("tomee-");
+        add("tools.jar");
+        add("twitter4j-");
+        add("velocity-");
+        add("wagon-");
+        add("webbeans-ee");
+        add("webbeans-ejb");
+        add("webbeans-impl");
+        add("webbeans-spi");
+        add("websocket-api");
+        add("woodstox-core-asl-");
+        add("ws-commons-util-");
+        add("wsdl4j-");
+        add("wss4j-");
+        add("wstx-asl-");
+        add("xalan-");
+        add("xbean-");
+        add("xercesImpl-");
+        add("xml-apis-");
+        add("xml-resolver-");
+        add("xmlbeans-");
+        add("xmlrpc-");
+        add("xmlschema-");
+        add("xmlsec-");
+        add("xmltooling-");
+        add("xmlunit-");
+        add("ziplock-");
+        add("zipfs.jar");
+    }};
+
+    @Override
+    public boolean check(final JarScanType jarScanType, final String jarName) {
+        return forceIncludes.stream().filter(jarName::startsWith).findAny().isPresent()
+                || !excludes.stream().filter(jarName::startsWith).findAny().isPresent();
+    }
+}

Added: openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/openwebbeans/OWBTomcatWebScannerService.java
URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/openwebbeans/OWBTomcatWebScannerService.java?rev=1766249&view=auto
==============================================================================
--- openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/openwebbeans/OWBTomcatWebScannerService.java
(added)
+++ openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/openwebbeans/OWBTomcatWebScannerService.java
Sun Oct 23 08:35:58 2016
@@ -0,0 +1,73 @@
+/*
+ * 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.microwave.openwebbeans;
+
+import org.apache.tomcat.JarScanFilter;
+import org.apache.webbeans.web.scanner.WebScannerService;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Set;
+
+import static org.apache.tomcat.JarScanType.PLUGGABILITY;
+
+public class OWBTomcatWebScannerService extends WebScannerService {
+    private JarScanFilter filter;
+    private String jreBase;
+
+    @Override
+    public void scan() {
+        if (finder != null) {
+            return;
+        }
+        super.scan();
+    }
+
+    @Override
+    protected void filterExcludedJars(final Set<URL> classPathUrls) {
+        if (filter == null) {
+            filter = new KnownJarsFilter();
+        }
+
+        String jreBaseTmp;
+        try {
+            jreBaseTmp = new File(System.getProperty("java.home")).toURI().toURL().toExternalForm();
+        } catch (MalformedURLException e) {
+            jreBaseTmp = System.getProperty("java.home");
+        }
+        jreBase = jreBaseTmp;
+
+        super.filterExcludedJars(classPathUrls);
+    }
+
+    @Override
+    protected int isExcludedJar(final String path) {
+        if (path.startsWith(jreBase)) {
+            return jreBase.length();
+        }
+
+        final int filenameIdx = path.replace(File.separatorChar, '/').lastIndexOf('/') +
1;
+        if (filenameIdx < 0 || filenameIdx >= path.length()) { // unlikely
+            return -1;
+        }
+
+        return filter.check(PLUGGABILITY, path.substring(filenameIdx)) ? -1 : (path.indexOf(".jar")
- 1);
+    }
+}

Modified: openwebbeans/microwave/trunk/microwave-core/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/microwave-core/src/main/resources/META-INF/openwebbeans/openwebbeans.properties?rev=1766249&r1=1766248&r2=1766249&view=diff
==============================================================================
--- openwebbeans/microwave/trunk/microwave-core/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
(original)
+++ openwebbeans/microwave/trunk/microwave-core/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
Sun Oct 23 08:35:58 2016
@@ -16,84 +16,4 @@
 #under the License.
 configuration.ordinal=1000
 org.apache.xbean.finder.filter.Filter=org.apache.microwave.openwebbeans.KnowClassesFilter
-org.apache.webbeans.scanExclusionPaths=\
-        /jre/lib, \
-        /Contents/Home/, \
-        /dt.jar, \
-        /tools.jar, \
-        /bootstrap.jar, \
-        /asm, \
-        /javassist, \
-        /xbean-, \
-        /jconsole.jar, \
-        /geronimo-, \
-        /commons-, \
-        /arquillian-, \
-        /bsh-, \
-        /shrinkwrap-, \
-        /junit-, \
-        /testng-, \
-        /openjpa-, \
-        /bcel, \
-        /hamcrest, \
-        /mysql-connector, \
-        /testng, \
-        /idea_rt, \
-        /eclipse, \
-        /jcommander, \
-        /tomcat, \
-        /catalina, \
-        /jasper, \
-        /jsp-api, \
-        /myfaces-api, \
-        /myfaces-impl, \
-        /servlet-api, \
-        /javax, \
-        /annotation-api, \
-        /el-api, \
-        /mojarra, \
-        /aopalliance-, \
-        /guice-, \
-        /sisu-guice-, \
-        /sisu-inject-, \
-        /aether-, \
-        /plexus-, \
-        /maven-, \
-        /guava-, \
-        /openwebbeans-, \
-        /bcprov-jdk14-, \
-        /bcmail-jdk14-, \
-        /bctsp-jdk14-, \
-        /bcmail-jdk14-, \
-        /ss_css2-, \
-        /itext-, \
-        /pd4ml-, \
-        /xmlpull-, \
-        /log4j-, \
-        /slf4j-, \
-        /logkit, \
-        /gson-, \
-        /xstream-, \
-        /httpclient-, \
-        /httpcore-, \
-        /backport-util-concurrent-, \
-        /xml-apis, \
-        /xpp3_min-, \
-        /bval-core, \
-        /bval-jsr, \
-        /hsqldb, \
-        /quartz-2, \
-        /jetty-, \
-        /plexus-,\
-        /johnzon-,\
-        /cxf-,\
-        /woodstox-,\
-        /stax,\
-        /xmlschema,\
-        /lombok,\
-        /javaee-api,\
-        /classworlds-,\
-        /wagon-,\
-        /ziplock-,\
-        /microwave-gradle-plugin, \
-        /microwave-maven-plugin
+org.apache.webbeans.spi.ScannerService=org.apache.microwave.openwebbeans.OWBTomcatWebScannerService



Mime
View raw message