bug 448004: Implement the changed Jar Scanner functionality.
diff --git a/org.eclipse.gemini.web.tomcat/src/main/java/org/eclipse/gemini/web/tomcat/internal/BundleDependenciesJarScanFilter.java b/org.eclipse.gemini.web.tomcat/src/main/java/org/eclipse/gemini/web/tomcat/internal/BundleDependenciesJarScanFilter.java
new file mode 100644
index 0000000..57b923e
--- /dev/null
+++ b/org.eclipse.gemini.web.tomcat/src/main/java/org/eclipse/gemini/web/tomcat/internal/BundleDependenciesJarScanFilter.java
@@ -0,0 +1,71 @@
+/*******************************************************************************

+ * Copyright (c) 2015 SAP SE

+ *

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution.

+ * The Eclipse Public License is available at

+ *   http://www.eclipse.org/legal/epl-v10.html

+ * and the Apache License v2.0 is available at

+ *   http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses.

+ *

+ * Contributors:

+ *   Violeta Georgieva - initial contribution

+ *******************************************************************************/

+

+package org.eclipse.gemini.web.tomcat.internal;

+

+import java.util.Collections;

+import java.util.HashSet;

+import java.util.Set;

+

+import org.apache.tomcat.JarScanFilter;

+import org.apache.tomcat.JarScanType;

+import org.osgi.framework.BundleContext;

+

+final class BundleDependenciesJarScanFilter implements JarScanFilter {

+

+    private static final String COMMA_SEPARATOR = ",";

+

+    /**

+     * By default the Bundle Dependencies Jar Scanner will exclude the bundles listed below from the scanning process as

+     * they do not provide TLDs and web-fragment.xml files: org.eclipse.osgi, javax.servlet, javax.servlet.jsp,

+     * javax.el,javax.websocket. The default behavior can be changed with property

+     * <code>org.eclipse.gemini.web.tomcat.scanner.skip.bundles</code>. The syntax is

+     * <code>org.eclipse.gemini.web.tomcat.scanner.skip.bundles=&lt;bundle-symbolic-name&gt;,&lt;bundle-symbolic-name&gt;,...</code>

+     */

+    static final String SCANNER_SKIP_BUNDLES_PROPERTY_NAME = "org.eclipse.gemini.web.tomcat.scanner.skip.bundles";

+

+    private static final String SCANNER_SKIP_BUNDLES_PROPERTY_VALUE_DEFAULT = "org.eclipse.osgi,javax.servlet,javax.servlet.jsp,javax.el,javax.websocket";

+

+    private final Set<String> skipBundles;

+

+    BundleDependenciesJarScanFilter(BundleContext bundleContext) {

+        this.skipBundles = Collections.unmodifiableSet(getBundlesToSkip(bundleContext));

+    }

+

+    @Override

+    public boolean check(JarScanType jarScanType, String bundleSymbolicName) {

+        if (this.skipBundles.contains(bundleSymbolicName)) {

+            return false;

+        }

+        return true;

+    }

+

+    private Set<String> getBundlesToSkip(BundleContext bundleContext) {

+        Set<String> result = new HashSet<>();

+        String property = bundleContext.getProperty(SCANNER_SKIP_BUNDLES_PROPERTY_NAME);

+

+        if (property == null) {

+            property = SCANNER_SKIP_BUNDLES_PROPERTY_VALUE_DEFAULT;

+        }

+

+        String[] bundlesNames = property.split(COMMA_SEPARATOR);

+        for (int i = 0; bundlesNames != null && i < bundlesNames.length; i++) {

+            result.add(bundlesNames[i]);

+        }

+

+        return result;

+    }

+}

diff --git a/org.eclipse.gemini.web.tomcat/src/main/java/org/eclipse/gemini/web/tomcat/internal/BundleDependenciesJarScanner.java b/org.eclipse.gemini.web.tomcat/src/main/java/org/eclipse/gemini/web/tomcat/internal/BundleDependenciesJarScanner.java
index d71f676..ae9fc50 100644
--- a/org.eclipse.gemini.web.tomcat/src/main/java/org/eclipse/gemini/web/tomcat/internal/BundleDependenciesJarScanner.java
+++ b/org.eclipse.gemini.web.tomcat/src/main/java/org/eclipse/gemini/web/tomcat/internal/BundleDependenciesJarScanner.java
@@ -1,14 +1,14 @@
 /*******************************************************************************
- * Copyright (c) 2009, 2014 VMware Inc.
+ * Copyright (c) 2009, 2015 VMware Inc.
  *
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
- * and Apache License v2.0 which accompanies this distribution. 
+ * and Apache License v2.0 which accompanies this distribution.
  * The Eclipse Public License is available at
  *   http://www.eclipse.org/legal/epl-v10.html
- * and the Apache License v2.0 is available at 
+ * and the Apache License v2.0 is available at
  *   http://www.opensource.org/licenses/apache2.0.php.
- * You may elect to redistribute this code under either of these licenses.  
+ * You may elect to redistribute this code under either of these licenses.
  *
  * Contributors:
  *   VMware Inc. - initial contribution
@@ -22,16 +22,17 @@
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLConnection;
-import java.util.Collections;
-import java.util.HashSet;
 import java.util.Set;
 
 import javax.servlet.ServletContext;
 
+import org.apache.jasper.servlet.JasperInitializer;
+import org.apache.tomcat.JarScanFilter;
+import org.apache.tomcat.JarScanType;
 import org.apache.tomcat.JarScanner;
 import org.apache.tomcat.JarScannerCallback;
 import org.apache.tomcat.websocket.server.WsSci;
-import org.eclipse.gemini.web.tomcat.internal.loading.BundleWebappClassLoader;
+import org.eclipse.gemini.web.tomcat.internal.loader.BundleWebappClassLoader;
 import org.eclipse.gemini.web.tomcat.internal.support.BundleDependencyDeterminer;
 import org.eclipse.gemini.web.tomcat.internal.support.BundleFileResolver;
 import org.osgi.framework.Bundle;
@@ -43,29 +44,16 @@
 /**
  * A <code>JarScanner</code> implementation that passes each of the {@link Bundle}'s dependencies to the
  * {@link JarScannerCallback}.
- * 
+ *
  * <p />
- * 
+ *
  * <strong>Concurrent Semantics</strong><br />
- * 
+ *
  * Thread-safe.
- * 
+ *
  */
 final class BundleDependenciesJarScanner implements JarScanner {
 
-    private static final String COMMA_SEPARATOR = ",";
-
-    /**
-     * By default the Bundle Dependencies Jar Scanner will exclude the bundles listed below from the scanning process as
-     * they do not provide TLDs and web-fragment.xml files: org.eclipse.osgi, javax.servlet, javax.servlet.jsp,
-     * javax.el,javax.websocket. The default behavior can be changed with property
-     * <code>org.eclipse.gemini.web.tomcat.scanner.skip.bundles</code>. The syntax is
-     * <code>org.eclipse.gemini.web.tomcat.scanner.skip.bundles=&lt;bundle-symbolic-name&gt;,&lt;bundle-symbolic-name&gt;,...</code>
-     */
-    static final String SCANNER_SKIP_BUNDLES_PROPERTY_NAME = "org.eclipse.gemini.web.tomcat.scanner.skip.bundles";
-
-    private static final String SCANNER_SKIP_BUNDLES_PROPERTY_VALUE_DEFAULT = "org.eclipse.osgi,javax.servlet,javax.servlet.jsp,javax.el,javax.websocket";
-
     private static final String JAR_URL_SUFFIX = "!/";
 
     private static final String JAR_URL_PREFIX = "jar:";
@@ -78,48 +66,64 @@
 
     private final BundleFileResolver bundleFileResolver;
 
-    private final Set<String> skipBundles;
+    private JarScanFilter jarScanFilter;
 
-    public BundleDependenciesJarScanner(BundleDependencyDeterminer bundleDependencyDeterminer, BundleFileResolver bundleFileResolver,
+    BundleDependenciesJarScanner(BundleDependencyDeterminer bundleDependencyDeterminer, BundleFileResolver bundleFileResolver,
         BundleContext bundleContext) {
         this.bundleDependencyDeterminer = bundleDependencyDeterminer;
         this.bundleFileResolver = bundleFileResolver;
-        this.skipBundles = Collections.unmodifiableSet(getBundlesToSkip(bundleContext));
+        this.jarScanFilter = new BundleDependenciesJarScanFilter(bundleContext);
     }
 
     @Override
-    public void scan(ServletContext context, ClassLoader classLoader, JarScannerCallback callback, Set<String> jarsToSkip) {
+    public JarScanFilter getJarScanFilter() {
+        return this.jarScanFilter;
+    }
+
+    @Override
+    public void setJarScanFilter(JarScanFilter jarScanFilter) {
+        this.jarScanFilter = jarScanFilter;
+    }
+
+    @Override
+    public void scan(JarScanType jarScanType, ServletContext context, JarScannerCallback callback) {
+        ClassLoader classLoader = context.getClassLoader();
         if (classLoader instanceof BundleWebappClassLoader) {
             Bundle bundle = ((BundleWebappClassLoader) classLoader).getBundle();
-            scanDependentBundles(bundle, callback);
+            scanDependentBundles(bundle, jarScanType, callback);
         }
     }
 
-    private void scanDependentBundles(Bundle rootBundle, JarScannerCallback callback) {
-        Set<Bundle> dependencies = this.bundleDependencyDeterminer.getDependencies(rootBundle);
-
+    private void scanDependentBundles(Bundle rootBundle, JarScanType jarScanType, JarScannerCallback callback) {
         Bundle apacheWebsocketBundle = FrameworkUtil.getBundle(WsSci.class);
         if (apacheWebsocketBundle != null) {
-            dependencies.add(apacheWebsocketBundle);
+            scanBundle(apacheWebsocketBundle, callback, false);
         }
 
+        Bundle apacheJasperBundle = FrameworkUtil.getBundle(JasperInitializer.class);
+        if (apacheJasperBundle != null) {
+            scanBundle(apacheJasperBundle, callback, false);
+        }
+
+        Set<Bundle> dependencies = this.bundleDependencyDeterminer.getDependencies(rootBundle);
+
         for (Bundle bundle : dependencies) {
-            if (!this.skipBundles.contains(bundle.getSymbolicName())) {
-                scanBundle(bundle, callback);
+            if (getJarScanFilter().check(jarScanType, bundle.getSymbolicName())) {
+                scanBundle(bundle, callback, true);
             }
         }
     }
 
-    private void scanBundle(Bundle bundle, JarScannerCallback callback) {
+    private void scanBundle(Bundle bundle, JarScannerCallback callback, boolean isWebapp) {
         File bundleFile = this.bundleFileResolver.resolve(bundle);
         if (bundleFile != null) {
-            scanBundleFile(bundleFile, callback);
+            scanBundleFile(bundleFile, callback, isWebapp);
         } else {
-            scanJarUrlConnection(bundle, callback);
+            scanJarUrlConnection(bundle, callback, isWebapp);
         }
     }
 
-    private void scanJarUrlConnection(Bundle bundle, JarScannerCallback callback) {
+    private void scanJarUrlConnection(Bundle bundle, JarScannerCallback callback, boolean isWebapp) {
         URL bundleUrl;
         String bundleLocation = bundle.getLocation();
         try {
@@ -130,57 +134,41 @@
                 bundleUrl = new URL(JAR_URL_PREFIX + bundleLocation + JAR_URL_SUFFIX);
             }
         } catch (MalformedURLException e) {
-            LOGGER.warn("Failed to create jar: url for bundle location " + bundleLocation);
+            LOGGER.warn("Failed to create jar: url for bundle location [" + bundleLocation + "].");
             return;
         }
 
-        scanBundleUrl(bundleUrl, callback);
+        scanBundleUrl(bundleUrl, callback, isWebapp);
     }
 
-    private void scanBundleFile(File bundleFile, JarScannerCallback callback) {
+    private void scanBundleFile(File bundleFile, JarScannerCallback callback, boolean isWebapp) {
         if (bundleFile.isDirectory()) {
             try {
-                callback.scan(bundleFile);
+                callback.scan(bundleFile, null, isWebapp);
             } catch (IOException e) {
-                LOGGER.warn("Failure when attempting to scan bundle file '" + bundleFile + "'.", e);
+                LOGGER.warn("Failure when attempting to scan bundle file [" + bundleFile + "].", e);
             }
         } else {
             URL bundleUrl;
             try {
                 bundleUrl = new URL(JAR_URL_PREFIX + bundleFile.toURI().toURL() + JAR_URL_SUFFIX);
             } catch (MalformedURLException e) {
-                LOGGER.warn("Failed to create jar: url for bundle file " + bundleFile);
+                LOGGER.warn("Failed to create jar: url for bundle file [" + bundleFile + "].");
                 return;
             }
-            scanBundleUrl(bundleUrl, callback);
+            scanBundleUrl(bundleUrl, callback, isWebapp);
         }
     }
 
-    private void scanBundleUrl(URL url, JarScannerCallback callback) {
+    private void scanBundleUrl(URL url, JarScannerCallback callback, boolean isWebapp) {
         try {
             URLConnection connection = url.openConnection();
 
             if (connection instanceof JarURLConnection) {
-                callback.scan((JarURLConnection) connection);
+                callback.scan((JarURLConnection) connection, null, isWebapp);
             }
         } catch (IOException e) {
-            LOGGER.warn("Failure when attempting to scan bundle via jar URL '" + url + "'.", e);
+            LOGGER.warn("Failure when attempting to scan bundle via jar URL [" + url + "].", e);
         }
     }
-
-    private Set<String> getBundlesToSkip(BundleContext bundleContext) {
-        Set<String> result = new HashSet<>();
-        String property = bundleContext.getProperty(SCANNER_SKIP_BUNDLES_PROPERTY_NAME);
-
-        if (property == null) {
-            property = SCANNER_SKIP_BUNDLES_PROPERTY_VALUE_DEFAULT;
-        }
-
-        String[] bundlesNames = property.split(COMMA_SEPARATOR);
-        for (int i = 0; bundlesNames != null && i < bundlesNames.length; i++) {
-            result.add(bundlesNames[i]);
-        }
-
-        return result;
-    }
 }
diff --git a/org.eclipse.gemini.web.tomcat/src/main/java/org/eclipse/gemini/web/tomcat/internal/ChainingJarScanner.java b/org.eclipse.gemini.web.tomcat/src/main/java/org/eclipse/gemini/web/tomcat/internal/ChainingJarScanner.java
index 12dd874..544506c 100644
--- a/org.eclipse.gemini.web.tomcat/src/main/java/org/eclipse/gemini/web/tomcat/internal/ChainingJarScanner.java
+++ b/org.eclipse.gemini.web.tomcat/src/main/java/org/eclipse/gemini/web/tomcat/internal/ChainingJarScanner.java
@@ -1,14 +1,14 @@
 /*******************************************************************************
- * Copyright (c) 2009, 2012 VMware Inc.
+ * Copyright (c) 2009, 2015 VMware Inc.
  *
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
- * and Apache License v2.0 which accompanies this distribution. 
+ * and Apache License v2.0 which accompanies this distribution.
  * The Eclipse Public License is available at
  *   http://www.eclipse.org/legal/epl-v10.html
- * and the Apache License v2.0 is available at 
+ * and the Apache License v2.0 is available at
  *   http://www.opensource.org/licenses/apache2.0.php.
- * You may elect to redistribute this code under either of these licenses.  
+ * You may elect to redistribute this code under either of these licenses.
  *
  * Contributors:
  *   VMware Inc. - initial contribution
@@ -16,21 +16,21 @@
 
 package org.eclipse.gemini.web.tomcat.internal;
 
-import java.util.Set;
-
 import javax.servlet.ServletContext;
 
+import org.apache.tomcat.JarScanFilter;
+import org.apache.tomcat.JarScanType;
 import org.apache.tomcat.JarScanner;
 import org.apache.tomcat.JarScannerCallback;
 
 /**
  * A <code>JarScanner</code> implementation that delegates to a chain of <code>JarScanner</code>s.
  * <p />
- * 
+ *
  * <strong>Concurrent Semantics</strong><br />
- * 
+ *
  * Thread-safe.
- * 
+ *
  */
 final class ChainingJarScanner implements JarScanner {
 
@@ -41,10 +41,20 @@
     }
 
     @Override
-    public void scan(ServletContext context, ClassLoader classloader, JarScannerCallback callback, Set<String> jarsToSkip) {
+    public void scan(JarScanType jarScanType, ServletContext context, JarScannerCallback callback) {
         for (JarScanner jarScanner : this.jarScanners) {
-            jarScanner.scan(context, classloader, callback, jarsToSkip);
+            jarScanner.scan(jarScanType, context, callback);
         }
     }
 
+    @Override
+    public JarScanFilter getJarScanFilter() {
+        return null;
+    }
+
+    @Override
+    public void setJarScanFilter(JarScanFilter jarScanFilter) {
+        // no-op
+    }
+
 }
diff --git a/org.eclipse.gemini.web.tomcat/src/test/java/org/eclipse/gemini/web/tomcat/internal/BundleDependenciesJarScannerTests.java b/org.eclipse.gemini.web.tomcat/src/test/java/org/eclipse/gemini/web/tomcat/internal/BundleDependenciesJarScannerTests.java
index 27003d9..a52d353 100644
--- a/org.eclipse.gemini.web.tomcat/src/test/java/org/eclipse/gemini/web/tomcat/internal/BundleDependenciesJarScannerTests.java
+++ b/org.eclipse.gemini.web.tomcat/src/test/java/org/eclipse/gemini/web/tomcat/internal/BundleDependenciesJarScannerTests.java
@@ -3,12 +3,12 @@
  *
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
- * and Apache License v2.0 which accompanies this distribution. 
+ * and Apache License v2.0 which accompanies this distribution.
  * The Eclipse Public License is available at
  *   http://www.eclipse.org/legal/epl-v10.html
- * and the Apache License v2.0 is available at 
+ * and the Apache License v2.0 is available at
  *   http://www.opensource.org/licenses/apache2.0.php.
- * You may elect to redistribute this code under either of these licenses.  
+ * You may elect to redistribute this code under either of these licenses.
  *
  * Contributors:
  *   VMware Inc. - initial contribution
@@ -18,8 +18,10 @@
 
 import static org.easymock.EasyMock.createMock;
 import static org.easymock.EasyMock.createNiceMock;
+import static org.easymock.EasyMock.eq;
 import static org.easymock.EasyMock.expect;
 import static org.easymock.EasyMock.isA;
+import static org.easymock.EasyMock.isNull;
 import static org.easymock.EasyMock.replay;
 import static org.easymock.EasyMock.verify;
 
@@ -30,19 +32,19 @@
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashSet;
-import java.util.Hashtable;
+
+import javax.servlet.ServletContext;
 
 import org.apache.tomcat.JarScannerCallback;
-import org.eclipse.gemini.web.tomcat.internal.loading.BundleWebappClassLoader;
+import org.eclipse.gemini.web.tomcat.internal.loader.BundleWebappClassLoader;
 import org.eclipse.gemini.web.tomcat.internal.support.BundleDependencyDeterminer;
 import org.eclipse.gemini.web.tomcat.internal.support.BundleFileResolver;
 import org.eclipse.gemini.web.tomcat.spi.ClassLoaderCustomizer;
+import org.eclipse.virgo.test.stubs.framework.StubBundle;
 import org.eclipse.virgo.test.stubs.framework.StubBundleContext;
 import org.junit.Test;
 import org.osgi.framework.Bundle;
 
-/**
- */
 public class BundleDependenciesJarScannerTests {
 
     private final BundleDependencyDeterminer dependencyDeterminer = createMock(BundleDependencyDeterminer.class);
@@ -54,7 +56,7 @@
     private final BundleDependenciesJarScanner scanner = new BundleDependenciesJarScanner(this.dependencyDeterminer, this.bundleFileResolver,
         this.bundleContext);
 
-    private final Bundle bundle = createMock(Bundle.class);
+    private final Bundle bundle = new StubBundle();
 
     private final JarScannerCallback callback = createMock(JarScannerCallback.class);
 
@@ -62,83 +64,85 @@
 
     private final Bundle dependency = createMock(Bundle.class);
 
+    private final ServletContext servletContext = createMock(ServletContext.class);
+
     @Test
     public void noDependencies() throws IOException {
-        expect(this.bundle.getHeaders()).andReturn(new Hashtable<String, String>());
         expect(this.dependencyDeterminer.getDependencies(this.bundle)).andReturn(Collections.<Bundle> emptySet());
 
-        replay(this.dependencyDeterminer, this.bundleFileResolver, this.bundle, this.callback);
-
         ClassLoader classLoader = new BundleWebappClassLoader(this.bundle, this.classLoaderCustomizer);
+        expect(this.servletContext.getClassLoader()).andReturn(classLoader);
 
-        this.scanner.scan(null, classLoader, this.callback, null);
+        replay(this.dependencyDeterminer, this.servletContext);
+
+        this.scanner.scan(null, this.servletContext, this.callback);
 
         ((URLClassLoader) classLoader).close();
 
-        verify(this.dependencyDeterminer, this.bundleFileResolver, this.bundle, this.callback);
+        verify(this.dependencyDeterminer, this.servletContext);
     }
 
     @Test
     public void scanDirectory() throws IOException {
-        expect(this.bundle.getHeaders()).andReturn(new Hashtable<String, String>());
         expect(this.dependencyDeterminer.getDependencies(this.bundle)).andReturn(new HashSet<>(Arrays.asList(this.dependency)));
 
         File dependencyFile = new File("src/test/resources");
         expect(this.bundleFileResolver.resolve(this.dependency)).andReturn(dependencyFile);
-        this.callback.scan(dependencyFile);
-
-        replay(this.dependencyDeterminer, this.bundleFileResolver, this.bundle, this.callback);
+        this.callback.scan(dependencyFile, null, true);
 
         ClassLoader classLoader = new BundleWebappClassLoader(this.bundle, this.classLoaderCustomizer);
+        expect(this.servletContext.getClassLoader()).andReturn(classLoader);
 
-        this.scanner.scan(null, classLoader, this.callback, null);
+        replay(this.dependencyDeterminer, this.bundleFileResolver, this.callback, this.servletContext);
+
+        this.scanner.scan(null, this.servletContext, this.callback);
 
         ((URLClassLoader) classLoader).close();
 
-        verify(this.dependencyDeterminer, this.bundleFileResolver, this.bundle, this.callback);
+        verify(this.dependencyDeterminer, this.bundleFileResolver, this.callback, this.servletContext);
     }
 
     @Test
     public void scanFile() throws IOException {
-        expect(this.bundle.getHeaders()).andReturn(new Hashtable<String, String>());
         expect(this.dependencyDeterminer.getDependencies(this.bundle)).andReturn(new HashSet<>(Arrays.asList(this.dependency)));
 
         File dependencyFile = new File("");
         expect(this.bundleFileResolver.resolve(this.dependency)).andReturn(dependencyFile);
-        this.callback.scan(isA(JarURLConnection.class));
-
-        replay(this.dependencyDeterminer, this.bundleFileResolver, this.bundle, this.callback);
+        this.callback.scan(isA(JarURLConnection.class), (String) isNull(), eq(true));
 
         ClassLoader classLoader = new BundleWebappClassLoader(this.bundle, this.classLoaderCustomizer);
+        expect(this.servletContext.getClassLoader()).andReturn(classLoader);
 
-        this.scanner.scan(null, classLoader, this.callback, null);
+        replay(this.dependencyDeterminer, this.bundleFileResolver, this.callback, this.servletContext);
+
+        this.scanner.scan(null, this.servletContext, this.callback);
 
         ((URLClassLoader) classLoader).close();
 
-        verify(this.dependencyDeterminer, this.bundleFileResolver, this.bundle, this.callback);
+        verify(this.dependencyDeterminer, this.bundleFileResolver, this.callback, this.servletContext);
     }
 
     @Test
     public void scanJarUrlConnection() throws IOException {
-        expect(this.bundle.getHeaders()).andReturn(new Hashtable<String, String>());
         expect(this.dependencyDeterminer.getDependencies(this.bundle)).andReturn(new HashSet<>(Arrays.asList(this.dependency))).times(2);
         expect(this.dependency.getLocation()).andReturn("file:src/test/resources/bundle.jar").andReturn(
             "reference:file:src/test/resources/bundle.jar");
         expect(this.dependency.getSymbolicName()).andReturn("bundle").anyTimes();
 
         expect(this.bundleFileResolver.resolve(this.dependency)).andReturn(null).times(2);
-        this.callback.scan(isA(JarURLConnection.class));
-
-        replay(this.dependencyDeterminer, this.bundleFileResolver, this.bundle, this.callback, this.dependency);
+        this.callback.scan(isA(JarURLConnection.class), (String) isNull(), eq(true));
 
         ClassLoader classLoader = new BundleWebappClassLoader(this.bundle, this.classLoaderCustomizer);
+        expect(this.servletContext.getClassLoader()).andReturn(classLoader).times(2);
 
-        this.scanner.scan(null, classLoader, this.callback, null);
+        replay(this.dependencyDeterminer, this.bundleFileResolver, this.callback, this.dependency, this.servletContext);
 
-        this.scanner.scan(null, classLoader, this.callback, null);
+        this.scanner.scan(null, this.servletContext, this.callback);
+
+        this.scanner.scan(null, this.servletContext, this.callback);
 
         ((URLClassLoader) classLoader).close();
 
-        verify(this.dependencyDeterminer, this.bundleFileResolver, this.bundle, this.callback);
+        verify(this.dependencyDeterminer, this.bundleFileResolver, this.callback, this.dependency, this.servletContext);
     }
 }
diff --git a/org.eclipse.gemini.web.tomcat/src/test/java/org/eclipse/gemini/web/tomcat/internal/ChainingJarScannerTests.java b/org.eclipse.gemini.web.tomcat/src/test/java/org/eclipse/gemini/web/tomcat/internal/ChainingJarScannerTests.java
index 400e9c8..e0fd60a 100755
--- a/org.eclipse.gemini.web.tomcat/src/test/java/org/eclipse/gemini/web/tomcat/internal/ChainingJarScannerTests.java
+++ b/org.eclipse.gemini.web.tomcat/src/test/java/org/eclipse/gemini/web/tomcat/internal/ChainingJarScannerTests.java
@@ -1,14 +1,14 @@
 /*******************************************************************************

- * Copyright (c) 2012, 2014 SAP AG

+ * Copyright (c) 2012, 2015 SAP AG

  *

  * All rights reserved. This program and the accompanying materials

  * are made available under the terms of the Eclipse Public License v1.0

- * and Apache License v2.0 which accompanies this distribution. 

+ * and Apache License v2.0 which accompanies this distribution.

  * The Eclipse Public License is available at

  *   http://www.eclipse.org/legal/epl-v10.html

- * and the Apache License v2.0 is available at 

+ * and the Apache License v2.0 is available at

  *   http://www.opensource.org/licenses/apache2.0.php.

- * You may elect to redistribute this code under either of these licenses.  

+ * You may elect to redistribute this code under either of these licenses.

  *

  * Contributors:

  *   Violeta Georgieva - initial contribution

@@ -20,10 +20,11 @@
 

 import java.util.ArrayList;

 import java.util.List;

-import java.util.Set;

 

 import javax.servlet.ServletContext;

 

+import org.apache.tomcat.JarScanFilter;

+import org.apache.tomcat.JarScanType;

 import org.apache.tomcat.JarScanner;

 import org.apache.tomcat.JarScannerCallback;

 import org.junit.Test;

@@ -35,13 +36,13 @@
     @Test

     public void testScan() {

         ChainingJarScanner chainingJarScanner = new ChainingJarScanner();

-        chainingJarScanner.scan(null, null, null, null);

+        chainingJarScanner.scan(null, null, null);

         assertTrue(this.scannedResources.size() == 0);

 

         String resource1 = "resource1";

         String resource2 = "resource2";

         chainingJarScanner = new ChainingJarScanner(jarScannerFor(resource1), jarScannerFor(resource2));

-        chainingJarScanner.scan(null, null, null, null);

+        chainingJarScanner.scan(null, null, null);

         assertTrue(this.scannedResources.size() == 2);

         assertTrue(resource1.equals(this.scannedResources.get(0)));

         assertTrue(resource2.equals(this.scannedResources.get(1)));

@@ -51,10 +52,20 @@
         return new JarScanner() {

 

             @Override

-            public void scan(ServletContext context, ClassLoader classloader, JarScannerCallback callback, Set<String> jarsToSkip) {

+            public void scan(JarScanType jarScanType, ServletContext context, JarScannerCallback callback) {

                 ChainingJarScannerTests.this.scannedResources.add(resource);

             }

 

+            @Override

+            public JarScanFilter getJarScanFilter() {

+                return null;

+            }

+

+            @Override

+            public void setJarScanFilter(JarScanFilter arg0) {

+                // no-op

+            }

+

         };

     }

 }