View Javadoc
1   package com.atlassian.plugin.osgi.factory.transform.stage;
2   
3   import com.atlassian.plugin.osgi.factory.transform.PluginTransformationException;
4   import com.atlassian.plugin.osgi.factory.transform.TransformContext;
5   import com.atlassian.plugin.osgi.factory.transform.TransformStage;
6   
7   import java.util.jar.JarEntry;
8   
9   /**
10   * The stages which scan for inner jars in attempt to create bundle classpath.
11   *
12   * @since 2.6.0
13   */
14  public class ScanInnerJarsStage implements TransformStage {
15      protected static final String INNER_JARS_BASE_LOCATION = "META-INF/lib/";
16  
17      public void execute(TransformContext context) throws PluginTransformationException {
18          for (final JarEntry jarEntry : context.getPluginJarEntries()) {
19              // we only want jar files under the defined base location.
20              if (jarEntry.getName().startsWith(INNER_JARS_BASE_LOCATION)
21                      && jarEntry.getName().endsWith(".jar")) {
22                  context.addBundleClasspathJar(jarEntry.getName());
23              }
24          }
25      }
26  }